Click to See Complete Forum and Search --> : Using RewriteRule in .htaccess


shritesh
04-14-2006, 08:47 AM
Hi, Fellow Programmers...

I have a issue for one of my project to handle following

if i give url as www.somesite.com/login then it should process actually www.somesite.com/login.php. From (GOD=GOOGLE ORIENTED DEVELOPMENT) ;) I found a possible solution using

RewriteRule /^(.*)$ /$1.php in .htaccess

But not getting the desired result . is the above line which will do it? if not please guide

Thankx
Shritesh

Scleppel
04-14-2006, 10:28 AM
Try this:
RewriteEngine On

# if it's not for a real file
# (like the real .php version or an image or CSS)
RewriteCond %{SCRIPT_FILENAME} !-f
# rewrite with a .php extension
RewriteRule ^(.+)$ $1.php [QSA,L]