开发者

Disable rewriterul for the page

I have htaccess file, here it is:

php_flag magic_quotes_gpc off
php_flag register_globals off
php_value max_execution_time 100
ErrorDocument 404 /index.php?key=404
RewriteEngine On

RewriteCond %{HTTP_HOST} !^humor\.mysite\.ru$
RewriteRule .* http://humor.mysite.ru%{REQUEST_URI} [R=301,L]

# Index Page
RewriteRule ^index\.html$ index.php [L]
RewriteRule ^index\.htm$ index.php [L]

# Humor
RewriteRule ^humor([0-9]+)\.html$ index.php?key=humor&id=$1 [L]
RewriteRule ^humor([0-9]+)-([0-9]+)\.html$ index.php?key=humor&af=$1&page=$2 [L]
RewriteRule ^top_week.html$ index.php?key=humor&af=2 [L]
RewriteRule ^top_monthe.html$ index.php?key=humor&af=3 [L]
RewriteRule ^random.html$ index.php?key=humor&af=4 [L]
RewriteRule ^top.html$ index.php?key=traffic&tr=1 [L]

# Common
RewriteRule ^humor/rate\.html$ index.php?key=humor&af=1; [L]
RewriteRule ^add\.html$ index.php?key=humor&add=1; [L]
RewriteRule ^humor/category([0-9]+)\.html$ index.php?key=humor&cat=$1 [L]
RewriteRule ^humor/category([0-9]+)-([0-9]+)\.html$ index.php?key=humor&cat=$1&page=$2 [L]

# Admin Area
RewriteRule ^admin/$ index.php?key=login  [L]
RewriteRule ^admin$ index.php?key=login  [L]

#开发者_StackOverflow社区 Default
RewriteRule ^([a-zA-Z_0-9\-]+)\.html$ index.php?key=$1  [L]
RewriteRule ^contest.html$ contest.html [L]

And i have google confirm file for webmasters, so when i add file at my root directory and try to see what inside throw the browser - server redirect me to index.php, but it should show me these file


Order of rules matters. Your very last line will NEVER get "executed" because previous rule will redirect all .html files to index.php.

Try these lines (you can safely delete the very last line for contest.html):

# Default
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([a-zA-Z_0-9\-]+)\.html$ index.php?key=$1 [L]

Alternatively, add these lines after domain redirect rules and before # Index Page block

# Do not do anything for already existing files or folders
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule .+ - [L]
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜