我写了重写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