Domanda

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?

È stato utile?

Soluzione 2

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]

Altri suggerimenti

To avoid an infinite loop, you may use this in .htaccess:

Options +FollowSymlinks
RewriteEngine on

RewriteRule ^(about|contact)$ $1.php [NC,L]

[NC,L] may be important and rewrite_mod should be enabled by

a2enmod rewrite
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top