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?

有帮助吗?

解决方案 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]

其他提示

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
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top