문제

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