Вопрос

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