分享

写回答

发帖

[提问] godaddy的Rewrite无效怎么办?

GoDaddy GoDaddy 1229 人阅读 | 4 人回复

发表于 2011-2-19 16:32:40 | 显示全部楼层 |阅读模式

这是我的.htaccess,高手帮我看下哪里不对?

#<IfModule mod_security.c>
#    secfilterengine off
#    secfilterscanPOST off
#</IfModule>

#Options All -Indexes
FileETag MTime Size
Options +FollowSymlinks
RewriteEngine on

<FilesMatch "\.(db|inc|tmpl|h|ihtml|sql|ini|configuration|config|class|bin|spd|theme|module|cfg|cpl|tmp|log|err|inc.php|class.php)$">
order allow,deny
satisfy all
</FilesMatch>

########## Begin - Rewrite rules to block out some common exploits
#                              
# Block out any script trying to set a mosConfig value through the URL
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]
# Block out any script trying to base64_encode crap to send via URL
RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]
# Block out any script that includes a <script> tag in URL
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
# Block out any script trying to set a PHP GLOBALS variable via URL
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
# Block out any script trying to modify a _REQUEST variable via URL
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
# Send all blocked request to homepage with 403 Forbidden error!
#RewriteRule ^(.*)$ index.php [L]
RewriteRule ^([^.]*)/?$ index.php [L]
#
########## End - Rewrite rules to block out some common exploits


RewriteEngine on
#
#
#
#URL Rewriting for Videos
RewriteRule ^videos/(.*)/(.*)/(.*)/(.*)/(.*) videos.php?cat=$1&sort=$3&time=$4&page=$5&seo_cat_name=$2 [L]
RewriteRule ^videos videos.php?%{QUERY_STRING} [L]
RewriteRule ^video/(.*)/(.*) watch_video.php?v=$1&%{QUERY_STRING} [L]
#
#Users, Channel & Management
#

RewriteRule ^channels/(.*)/(.*)/(.*)/(.*)/(.*) channels.php?cat=$1&sort=$3&time=$4&page=$5&seo_cat_name=$2 [L]
RewriteRule ^channels channels.php [L]
RewriteRule ^members/                                                                channels.php [nc]
RewriteRule ^users/                                                                        channels.php [nc]
RewriteRule ^user/(.*)                                                view_channel.php?user=$1 [nc]
RewriteRule ^channel/(.*)                                        view_channel.php?user=$1 [nc]


RewriteRule ^my_account                                        myaccount.php [nc]



#Pages
RewriteRule ^page/([0-9]+)/(.*)                                                view_page.php?pid=$1 [nc]
#
#Miscellenous
RewriteRule ^search/result                                                        search_result.php [nc]
RewriteRule ^upload                                                                        upload.php [nc]
RewriteRule ^contact                                                                contact.php [nc]
RewriteRule ^categories                                                                categories.php [nc]

#Group Section

RewriteRule ^group/([a-zA-Z0-9].+)                                        view_group.php?url=$1&%{QUERY_STRING} [L]
RewriteRule ^view_topic/([a-zA-Z0-9].+)_tid_([0-9]+)                                        view_topic.php?tid=$2&%{QUERY_STRING} [L]
RewriteRule ^groups/(.*)/(.*)/(.*)/(.*)/(.*) groups.php?cat=$1&sort=$3&time=$4&page=$5&seo_cat_name=$2 [L]
RewriteRule ^groups groups.php [L]
RewriteRule ^create_group create_group.php [L]


RewriteRule ^sitemap.xml$ sitemap.php
RewriteRule ^signup signup.php

#Error Pages
ErrorDocument 404 /404.php
ErrorDocument 403 /403.php

########## End - Rewrite rules For SEO urls ######################
RewriteRule ^rss$                           rss.php [nc]
RewriteRule ^rss/([a-zA-Z0-9].+)$          rss.php?mode=$1&%{QUERY_STRING} [nc]

########## End - Rewrite rules For SEO urls ######################

回答|共 4 个

add.c

发表于 2011-2-19 16:48:59 | 显示全部楼层

你的是linux主机么, .htaccess是放到网站所在目录的么

mkey911

发表于 2011-2-19 16:50:55 | 显示全部楼层

上面的代码会导致网站出现500错误,只有注销掉Options All -Indexes这一行网站才能打开,但是问题是打开网站的其它链接会出现404错误。

mkey911

发表于 2011-2-19 16:52:07 | 显示全部楼层

是linux主机,.htaccess也是放在网站所在目录的

add.c

发表于 2011-2-19 17:15:48 | 显示全部楼层

那不是无效, 是代码有错误
具体可以联系程序提供商
您需要登录后才可以回帖 登录 | 注册

本版积分规则