【问题标题】:Catching part of the url with .htaccess and change it使用 .htaccess 捕获部分 url 并更改它
【发布时间】:2014-10-02 00:35:32
【问题描述】:


我正在尝试从旧的 Wordpress 帖子网址重定向我的用户:

example.com/al-gacho/archives/608

收件人:

example.com/blog/archives/608

我需要做的就是捕获 /al-gacho/ 并将其替换为 /blog/。
有人可以帮忙吗? :( 谢谢!

【问题讨论】:

    标签: apache .htaccess redirect web


    【解决方案1】:

    您可以使用这个RedirectMatch 规则:

    RedirectMatch 301  ^/al-gacho/(.+)$ /blog/$1
    

    确保这是您的根目录 .htaccess 中的第一行

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多