【问题标题】:How to remove 301 redirect from .htaccess?如何从 .htaccess 中删除 301 重定向?
【发布时间】:2023-03-27 23:26:01
【问题描述】:

我正在尝试通过应用重定向 301 的网站解决此问题。这是我的.htaccess

RewriteEngine on

# Redirect "/" to Landing
RewriteRule ^$ http://greenengineering.com.au/landing/ [R=301,L]

# Additionally, redirect "/index.html" to Landing
RedirectMatch 301 ^/index\.html$ /landing

谁能指导我如何删除此重定向,以便用户可以访问主域http://greenengineering.com.au

【问题讨论】:

    标签: apache .htaccess mod-rewrite http-redirect


    【解决方案1】:

    在开发过程中最好使用临时重定向 (302),直到您确定自己的规则。

    下面的行将永久重定向

    http://greenengineering.com.au/ --> http://greenengineering.com.au/landing/

    # Redirect "/" to /landing/
    RewriteRule ^$ /landing/ [R=301,L]
    

    下面的行也将永久重定向

    http://greenengineering.com.au/index.html --> http://greenengineering.com.au/landing/

    # Redirect "/index.html" to /landing/
    RewriteRule ^index\.html /landing/ [L=301,L]
    

    删除您不再希望使用的规则。如果你发现 301 重定向还在发生,那么请看How can I make Chrome stop caching redirects?How long do browsers cache HTTP 301s?

    【讨论】:

      【解决方案2】:

      只需从您的.htaccess 中删除这些行。如果您的浏览器 may have cached 无法正常工作,则 301 重定向,因为它是永久的。尝试重新启动浏览器或使用其他浏览器检查是否正常。

      【讨论】:

        猜你喜欢
        • 2016-07-02
        • 2016-07-19
        • 1970-01-01
        • 2016-10-07
        • 2017-07-27
        • 1970-01-01
        • 1970-01-01
        • 2018-01-22
        • 2012-08-16
        相关资源
        最近更新 更多