【问题标题】:htaccess file not redirecting 404 pages to my index.php pagehtaccess 文件未将 404 页面重定向到我的 index.php 页面
【发布时间】:2013-10-21 22:23:51
【问题描述】:
<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 url 是由 IIS 生成的,所以它显示为:localhost:26139/

但即使我将其添加到我的重写基础上,它也不起作用。

【问题讨论】:

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


    【解决方案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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-11-21
      • 2011-12-05
      • 1970-01-01
      • 1970-01-01
      • 2018-04-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多