所以我有这个.htaccess:
RewriteEngine On
RewriteBase /
RewriteRule ^home$ /index.php [L]
RewriteRule ^edit$ /edit.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)$ /new.php
它将任何未知的 url 重定向到/new.php
并且仅将保留的/homeand重定向/edit到适当的页面
但我也想将任何人重定向到根目录/并/index.php|html转到/home
所以我尝试了这个:
RewriteRule ^index\.(php|html?)$ /home [R=301,L]
但它会导致一个循环,这是可以理解的。
它还/home通过导致自身环回来破坏我的重定向。如何让/and/index.php重定向到/index.php,但仍然/home在它之后添加?
我还尝试删除每条 RewriteCond 行,但它没有任何好处..