Jump to content

url rewrite server error 500


gongpex

Recommended Posts

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 by gong
Link to comment
Share on other sites

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

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

  • 1 month later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...