Apache .htaccess转到404-url重写

Apache .htaccess转到404-url重写,apache,.htaccess,url-rewriting,Apache,.htaccess,Url Rewriting,我一直在使用apache成功地在不同的服务器上使用.htaccess,但由于某些原因,我无法让它在这个新的主机包上工作,因为我一直在“未找到页面”屏幕上看到以下消息:“此服务器上未找到请求的URL/关于我们”。 浏览器中的URL如下所示:www.mysite.com/about-us 我的代码如下: RewriteEngine on Options +FollowSymlinks DirectoryIndex index.php RewriteCond %{REQUEST_FILENAME}

我一直在使用apache成功地在不同的服务器上使用.htaccess,但由于某些原因,我无法让它在这个新的主机包上工作,因为我一直在“未找到页面”屏幕上看到以下消息:“此服务器上未找到请求的URL/关于我们”。 浏览器中的URL如下所示: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]
谢谢你的帮助
谢谢

您的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]

你的新主机提供商支持mod_重写吗?我已经在里面添加了我的代码。我将DirectoryIndex.php改为DirectoryIndex.htm index.php,该站点现在将我带到index.htm。我猜这意味着启用了mod rewrite。回答:
RewriteRule^(.*)$/index.php?mode=$1[L,QSA]