.htaccess转到404 - url重写

时间:2012-01-30 15:17:11

标签: apache .htaccess url-rewriting

我一直在使用apache在不同的服务器上使用.htaccess但由于某种原因我不能让它在这个新的主机包上工作,因为我不断收到“找不到页面”屏幕,显示以下消息:“在此服务器上找不到请求的URL / about-us“。 浏览器中的网址如下所示:www.mysite.com/about-us

我的代码如下:

RewriteEngine on
Options +FollowSymlinks
DirectoryIndex index.php

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*)$ index.php?mode=$1 [L,QSA]

任何帮助表示赞赏 感谢

1 个答案:

答案 0 :(得分:0)

您的favicon.ico状况可能会打破比赛。要取消模式,只使用!而不是否定按字典顺序排列的匹配。

RewriteEngine on
Options +FollowSymlinks
DirectoryIndex index.php

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !^favicon\.ico [NC]
RewriteRule ^(.*)$ index.php?mode=$1 [L,QSA]
相关问题