问题
I've got a really simple question. I want to redirect all requests to http://localhost/home/ and http://localhost/home to home.php
My .htaccess
file contains:
RewriteRule ^home/$ home.php [L]
which only works for http://localhost/home/
How can I make it work without the /
in the url too? Is it possible to do it in one line, as opposed to two separate lines such as:
RewriteRule ^home/$ home.php
RewriteRule ^home$ home.php
Thanks :)
回答1:
RewriteRule ^home/?$ home.php [L]
回答2:
RewriteRule ^home/?$ home.php
来源:https://stackoverflow.com/questions/2117401/mod-rewrite-http-localhost-home-or-http-localhost-home-to-home-php