944media
asked on
Rewriting URL (http://www.mysite.com/home/ looks at home.php)
I am using Apache 2.2 on Windows. I have an URL like this:
http://www.mysite.com/home/
Which I really want to go to home.php.
(There is also http://www.mysite.com/test/ which goes to test.php etc)
I think mod_rewrite may be the solution, however, I have no experience with this.
http://www.mysite.com/home/
Which I really want to go to home.php.
(There is also http://www.mysite.com/test/ which goes to test.php etc)
I think mod_rewrite may be the solution, however, I have no experience with this.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
The recent works well with /home/.
To add a trick to it, there are additional sub directories (i.e. /home/filestructure/) which I still want to go to /home.php.
There is also /contacts/search/ which needs to go to contacts.php and soo on.
To add a trick to it, there are additional sub directories (i.e. /home/filestructure/) which I still want to go to /home.php.
There is also /contacts/search/ which needs to go to contacts.php and soo on.
RewriteCond %{REQUEST_URI} !\.php$
RewriteCond %{REQUEST_URI} ^/([^/]+)
RewriteRule . %1.php [L]
RewriteCond %{REQUEST_URI} ^/([^/]+)
RewriteRule . %1.php [L]
RewriteRule ^([^/\.]+)/?$ /$1.php [L]