【问题标题】:htaccess redirect subdirectory to another subdirectoryhtaccess 将子目录重定向到另一个子目录
【发布时间】:2019-11-24 22:42:41
【问题描述】:

由于 Seo 问题,我必须将我的 URL 从 /blog.html/* 重定向到 /blog/*。 寻找 .htaccess 规则

RewriteRule ^blog.html/?(.*)$ /blog/$1 [R=301,NC,L]

这个已经试过了

我试过了

RewriteEngine on
RewriteRule ^/?folderA/(.*)$ /folderB/$1 [R,L]

但这只会将 domain/blog.html 重定向到 domain/blog 而不会将 domain/blog.html/anyblog 重定向到 domain/blog/anyblog

我的网站托管在 cpanel 上,而博客是通过 WordPress 添加的,因此两个网站的 .httaccess 文件不同。

【问题讨论】:

    标签: wordpress apache .htaccess cpanel http-redirect


    【解决方案1】:
    RewriteEngine On 
    RewriteBase / 
    RedirectMatch 301 ^/blog.html/(.*)$ http://abcd.com/blog/$1
    

    这应该可行。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-01-16
      • 2015-10-08
      • 2014-09-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-04-18
      • 1970-01-01
      相关资源
      最近更新 更多