0

我写了重写url的规则

RewriteRule ^([a-zA-Z0-9-/]+)$ news.php?id=$1
RewriteRule ^([a-zA-Z0-9-/]+)/$ news.php?id=$1

但我需要http://mysite.com/blog/不要被这些规则重写。谢谢你的建议:)。

我的 .htaccess 文件:

RewriteEngine On 
RewriteBase / 
RewriteCond %{REQUEST_URI} !news\.php [NC] 
RewriteCond %{REQUEST_URI} !/blog [NC] 
RewriteCond %{REQUEST_URI} ^/([^/]+) [NC] 
RewriteRule .* news.php?id=%1 [R=301,L] 
RewriteRule ^video_([^/]+) video.php?page=Video&table=$1 
RewriteRule ^en/([a-zA-Z0-9-/]+)$ en/news_en.php?no=$1 
RewriteRule ^en/([a-zA-Z0-9-/]+)/$ en/news_en.php?no=$1 
RewriteRule ^it/([a-zA-Z0-9-/]+)$ it/news.php?id=$1 
RewriteRule ^it/([a-zA-Z0-9-/]+)/$ it/news.php?id=$1 

RewriteRule ^photo_([^/]+) photogalery.php?page=Photo&part=$1 
RewriteRule ^en/photo_([^/]+) en/photogalery.php?page=Photo&part=$1 
RewriteRule ^it/photo_([^/]+) it/photogalery.php?page=Photo&part=$1 
ErrorDocument 404 /404.html 
4

1 回答 1

0

利用

重写引擎开启
重写规则 ^blog/([a-zA-Z0-9_-]+)$ news.php?id=$1
于 2013-01-30T07:41:39.990 回答