RewriteRule 不包含联系和关于单词

RewriteRule doesn't with contact and about words

所以基本上有些词不适用于 RewriteRule,这让我抓狂。

这是我的 htaccess 代码,它不起作用:

    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^contact/?$ index.php?page=contact [NC,L]
    RewriteRule ^about/?$ index.php?page=about [NC,L]

使用这个我得到这个错误:"The requested URL /about was not found on this server."

如果我更改 "contact" 和 "about" 并输入任何其他词,则效果很好:

    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^contactme/?$ index.php?page=contact [NC,L]
    RewriteRule ^aboutme/?$ index.php?page=about [NC,L]

这很好用,但我想使用简单的联系方式和关于。

有什么想法吗?

你可以使用它:

RewriteEngine On
Options -MultiViews
RewriteBase /
RewriteRule ^contact/?$ index.php?page=contact [NC,L]
RewriteRule ^about/?$ index.php?page=about [NC,L]

MultiViews的效果如下:如果服务器收到对/some/dir/foo的请求,如果/some/dir启用了MultiViews,而/some/dir/foo不存在,则服务器读取查找名为 foo.* 的文件的目录,并有效地伪造了一个命名所有这些文件的类型映射,为它们分配相同的媒体类型和内容编码,如果客户端通过名称请求其中一个文件,它们将具有相同的媒体类型和内容编码。然后选择最符合客户要求的。