View Full Version : Resolved htaccess mod_rewrite
john0611
01-10-2010, 04:44 PM
Hi,
Can anyone help; I have urls with .php extensions.
http://domain.com/our_profile.php
Is there a way to remove the .php file extensions using .htaccess?
http://domain.com/our_profile/
Many thanks for any help.
Schmoopy
01-10-2010, 04:50 PM
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
john0611
01-10-2010, 05:11 PM
Hi, thanks for quick reply,
I am getting a 500 Internal Server Error, I am relatively new to .htaccess I am not quiet sure whats going on. I know how to initiated the htaccess file but not sure why the 500 error?
Thanks again for your reply.
You're getting the 500 error because this option isn't enabled in http.conf. If you're doing this locally, find http.conf in the parent directory of your www folder, if your doing this online, and the cpanel isn't giving you an option to modify it, contact your host.
But, if it does, find this line:
#LoadModule rewrite_module modules/mod_rewrite.so
And remove the #.
Good luck
Schmoopy
01-10-2010, 05:17 PM
Make sure you put:
domain.com/myfilehere
And not:
domain.com/myfilehere/
The last / will give you the error.
You may want to fix that for him - its not common that people don't put the '/'.
john0611
01-10-2010, 05:42 PM
Cracked it!
Thanks for all the help guys!
Schmoopy
01-11-2010, 07:53 PM
Having said that, does anyone have any idea why the trailing / brings up an internal error, and have any way of fixing it?
Cheers.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.