gongpex Posted July 30, 2012 Share Posted July 30, 2012 (edited) Hello everyone, I had tried to rewrite my web page address using .htaccess file, and this the code: RewriteEngine onRewriteRule ^(.*)\php$ $1. [nc] But, it shown "server error 500", What the mistake on my .htacess file code? Note : I looking from google I often found code like this : RewriteEngine onRewriteRule ^(.*)\.htm$ $1.php [nc] But it's not useful. I want to rewrite from : localhost/test/index.php to localhost/test/index please someone help me Thanks Edited July 30, 2012 by gong Link to comment Share on other sites More sharing options...
Don E Posted July 30, 2012 Share Posted July 30, 2012 I use this: RewriteRule ^([a-zA-Z]+)$ $1.php [nc,l] If a link on a page looks like this for example: <a href="services" title="Services">Services</a>, when clicked on, it will go to services.php but what's being displayed is: www.site.com/services Link to comment Share on other sites More sharing options...
Ingolme Posted July 31, 2012 Share Posted July 31, 2012 It might be that the rewrite module is not activated on your server. Wrap the rewrite code between <IfModule> tags: <IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^(.*)\.php$ $1 [nc]</IfModule> Link to comment Share on other sites More sharing options...
gongpex Posted September 10, 2012 Author Share Posted September 10, 2012 Long time I didn't tried this code, and today I had tried it : <IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^(.*)\.php$ $1 [nc]</IfModule> But it cause "Object not found" when I open for example : http://localhost/test/index Please help me Thanks Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now