Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当人们键入时,我想重定向到 new/index.php
site.com site.com/index.php site.com/index.html site.com/index.htm
所以下面的代码可能对吗?
Options +FollowSymLinks RewriteEngine on RewriteRule ^index\.(html|php|htm)$ new/index.php
改用这个:
RewriteEngine on RewriteRule ^(index\.(html?|php))?$ /new/index.php [L,NC,QSA,R=301]
如果您不希望人们看到那里的地址栏更改为 /new,请删除该R=301标志。
R=301
您可以在此处获得有关 mod_rewrite的更多信息
几乎,你没有与 匹配site.com,所以在你所拥有的之上,添加:
site.com
RewriteRule ^$ new/index.php [L]