Jump to content
Sign in to follow this  
gongpex

url rewrite server error 500

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

Share this post


Link to post
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

Share this post


Link to post
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>

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...