Ad

Mod_rewrite Http://localhost/home/ Or Http://localhost/home To Home.php

- 1 answer

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 :)

Ad

Answer

RewriteRule ^home/?$ home.php [L]
Ad
source: stackoverflow.com
Ad