1
我的.htaccess:如何使.htaccess规则不被覆盖?
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^product-([^/]+).html$ index.php?tid=$1 [L]
RewriteRule ^links-([^/]+).html$ index.php?page=links&lid=$1 [L]
RewriteRule ^([^/]+).html$ index.php?page=$1 [L]
问题:
如果我把对主站点的目录文件test.html
它变得不可见。
如果我改变我的htaccess文件规定:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+).html$ index.php?page=$1 [L]
RewriteRule ^product-([^/]+).html$ index.php?tid=$1 [L]
RewriteRule ^links-([^/]+).html$ index.php?page=links&lid=$1 [L]
我在URL /product-10.html
404错误,但test.html
可用。
如何在这两种情况下,它的工作这样做(的test.html必须是可用的,如果存在,产品-10.html必须重定向到的index.php?TID = 10)?
哇!它真的很有用。谢谢! – xercool
很高兴知道,您是否可以通过点击答案左上角的刻度线来将答案标记为已接受。 – anubhava