Jump to content

Mod Rewrite (example.com/contact.php to example.com/contact)


jou00jou

Recommended Posts

As the subject suggests, I would like to use Mod Rewrite to rewrite the url from example.com/contact.php to example.com/contact

 

I am currently learning how to use mod rewrite and read at least 10 tutorials but for some reasons I still can't create the rule. I simply need to remove the php trailer in all the files in the directory.

 

Here is the what I thought would work.

 

RewriteRule ^([a-z]+)$ /$1.php [L]

 

Below are other combinations I tried

 

RewriteRule ^([a-z]+)$ $1.php [L] (no slash before $1)

RewriteRule ^(.*)$ /$1.php [L]

...

 

I tried more combinations but really there is no point of writing them all.

 

Any ideas. Thanks in advance. By the way mod rewrite works on my server. I use it to rewrite www.example.com to example.com

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.