如果这是我的网站,并且用户输入了以下网址:
http://mydomain.com/
我怎样才能让它看起来像这样 每次有人访问主页:
http://mydomain.com/index.php
您可以在DOCUMENT_ROOT/.htaccess
文件中使用 RedirectMatch
指令:
RedirectMatch 302 ^/?$ /index.php
或使用mod_rewrite:
RewriteEngine On
RewriteRule ^/?$ /index.php [L,R]