【问题标题】:Simple rewrite rule isn't working on third level domain简单的重写规则不适用于三级域
【发布时间】:2014-12-02 23:58:43
【问题描述】:

我有一个具有以下 htaccess 规则的三级域 m.numeroverde.com

RewriteEngine On
RewriteBase /
RewriteRule ^home/?$ index.php

ErrorDocument 404 /404.html

404 错误页面在实际的 404 页面上正确显示,但 m.numeroverde.com/home 也被识别为 404 页面,当它应该链接到 index.php 页面时。 p>

我是否必须在我的 htaccess 中为第三级域写一些东西?

【问题讨论】:

  • 验证您的.htaccess 是否启用,方法是在您的.htaccess 顶部放置相同的垃圾(随机)文本,看看它是否会产生500(内部服务器)错误?跨度>
  • 我按照@anubhava 的建议做了,就像这样:fgdxhcjjiuygfdv bdgfx hsbgx fhgx asd RewdriteEngine On RewriteBase / RewriteRule ^home/?$ index.php [L] ErrorDocument 404 /404.html ... 它不会产生 500 错误,但会显示我的自定义 404 页面!我尝试将404.html 替换为400.html,只是为了进行测试,它会生成默认的404 Apache 页面,其中显示“此外,在尝试使用ErrorDocument 处理请求时遇到了404 Not Found 错误”。因为,显然,页面 400.html 不存在。
  • 如果 htaccess 中的垃圾文本没有生成 500,那么它根本没有被访问。
  • 那为什么 ErrorDocument 被处理,即使目标文件丢失?
  • ErrorDocument 也可以设置在其他地方。

标签: php apache .htaccess mod-rewrite


【解决方案1】:

所以,经过反复尝试,解决我的问题所需的字符串是:

Options -MultiViews

在我的 htaccess 顶部(这里是帮助我理解 http://alexcican.com/post/how-to-remove-php-html-htm-extensions-with-htaccess/ 的帖子)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-09-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-01-29
    • 2013-03-01
    • 1970-01-01
    相关资源
    最近更新 更多