【问题标题】:htaccess 301 redirect with different folder structurehtaccess 301重定向具有不同的文件夹结构
【发布时间】:2015-09-15 20:30:31
【问题描述】:

在此先感谢大家,我以为我已经掌握了这一点,但显然没有!

我正在使用 htaccess 重定向将网站永久移动到新域

旧地址 www.example.com/home/index.php

新地址 www.example2.ie/index.php

我曾尝试使用 RedirectMatch 301 ^/ http://example2.ie/,但最终得到像 http://example2.iehome/ 这样的网址......

我该如何解决这个问题,我什至可以用上面的方法正确解决这个问题吗?

干杯

【问题讨论】:

  • 我认为您可能需要转义尾部的正斜杠,并可能还添加另一个正斜杠来“关闭”替换字符串,几年没有这样做,也没有时间马上查看手册...

标签: regex apache .htaccess redirect


【解决方案1】:

你应该使用:

RedirectMatch 301 ^/home/(.+)$ http://example2.ie/$1

【讨论】:

    猜你喜欢
    • 2011-12-15
    • 1970-01-01
    • 2014-10-17
    • 2014-12-03
    • 1970-01-01
    • 1970-01-01
    • 2020-12-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多