htaccess文件没有将404页面重定向到我的index.php页面

时间:2013-10-21 22:23:51

标签: .htaccess mod-rewrite http-status-code-404

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

此htaccess规则不会重定向404错误或只是将未找到的页面重定向到索引页

我做错了什么?

我的localhost网址由IIS生成,因此它显示为:localhost:26139 /

但即使我将其作为我的重写基础的前缀,它也不起作用。

1 个答案:

答案 0 :(得分:1)

IIS本身不使用.htaccess文件。

在IIS中使用名为Web.config的文件,您需要处理该文件以进行重定向

参考链接:http://www.iis.net/learn/application-frameworks/install-and-configure-php-applications-on-iis/translate-htaccess-content-to-iis-webconfig