...

help mod rewrite .php to nothing

likon
05-21-2009, 05:17 PM
guys.


any htaccess script to remove something like

localhost/contact.php .

to localhost/contact

(stripped off the .php )


and do i need to change all link in something.php to something ?

that would be a little inconvenient but any other thoughts ?

thanks

sea4me
05-21-2009, 11:29 PM
Please ask a mod to move this to the new Apache configuration forum.

BTW try this:

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(about|contact|index|welcome|info)\.php\ HTTP/ [NC]
RewriteRule .* http://www.YOURSITE.com/%1 [R=301,QSA]

RewriteRule ^(about|contact|index|welcome|info)/? /$1.php [QSA,L]


replace about contact index welcome.... with your files you want to do and replace YOURSITE with your site name...

likon
05-22-2009, 01:52 AM
hi thank you for moving this thread to the right one . .. never thought this thread exists... i ll try ur suggestion tonight thanks

likon
05-22-2009, 05:24 PM
sea4me

actually i didn't work for me . i am not sure why..


i only have pages like about contact gallery and so on ...

each of them are in .php extension

i just wanted to remove the .php ... so you can see it like
localhost/contact

localhost/about

and of source after development it will be deployed on www.something.com/contact.

which i could just change the YOURSITE.com from localhost to something.com right ? but anyway it does not work on localhost....

any advice? thanks

sea4me
05-23-2009, 05:15 AM
did u turn on rewrite engine?

Options +FollowSymLinks

RewriteEngine On
RewriteBase /

schleppel
05-27-2009, 12:03 AM
actually i didn't work for me . i am not sure why..
What happens when you go to /contact?

Try
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{THE_REQUEST} \ /(about|contact|index|welcome|info)\.php(\?.*)?\ [NC]
RewriteRule . /%1 [R=301,L]

RewriteRule ^(about|contact|index|welcome|info)/? /$1.php [QSA,L]

destruction
06-03-2009, 12:33 PM
I'm still not changed following the yours
:(

schleppel
06-03-2009, 10:28 PM
What happens when you go to /contact? Do you get a 404 error?

If you put the following in your .htaccess file
Options +FollowSymLinks

RewriteEngine On

RewriteRule cf http://codingforums.com/? [R=301,L]
and go to /cf, do you get redirected to CodingForums?

destruction
06-11-2009, 08:57 PM
Try this one:


Options +FollowSymLinks

RewriteEngine On

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^contact\.php$ /contact [NC,R=301,L]

RewriteRule ^contact$ /contact.php [NC,QSA,L]
RewriteRule ^contact/([^/]+)/?$ contact.php?ID=$1 [QSA,L]


For mine that's worked.

Regards,
D



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum