0

我只是想清理一个像这样的网址:

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

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

我的 .htaccess 文件:

 Options +FollowSymlinks
 RewriteEngine on


 RewriteRule ^about about.php [NC]  

错误:

Not Found

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

这里有什么问题?

4

2 回答 2

0

看来我必须禁用multiviews默认启用的功能。

我的.htaccess:

Options +FollowSymLinks -Multiviews
RewriteEngine on

RewriteRule ^(about|contact)$ $1.php [NC,L]
于 2013-10-29T23:56:19.770 回答
0

为避免无限循环,您可以在 .htaccess 中使用它:

Options +FollowSymlinks
RewriteEngine on

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

[NC,L] 可能很重要,rewrite_mod 应该由

a2enmod rewrite
于 2013-10-29T23:24:39.627 回答