Search code examples
apache.htaccessmod-rewriteclean-urls

How to do a simple Mod_Rewrite


I'm simply looking to clean a urls like:

/// FROM :
http://mydomain.com/about.php
http://mydomain.com/contact.php

/// TO:
http://mydomain.com/about
http://mydomain.com/contact

My .htaccess file:

 Options +FollowSymlinks
 RewriteEngine on


 RewriteRule ^about about.php [NC]  

Error:

Not Found

The requested URL /about was not found on this server.

What is the problem here?


Solution

  • It seems i had to disable multiviews which was enabled by default.

    My .htaccess:

    Options +FollowSymLinks -Multiviews
    RewriteEngine on
    
    RewriteRule ^(about|contact)$ $1.php [NC,L]