htaccess重定向子目录到另一个子目录

时间:2019-07-16 08:30:40

标签: wordpress apache .htaccess cpanel http-redirect

由于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文件都不相同。

1 个答案:

答案 0 :(得分:1)

RewriteEngine On 
RewriteBase / 
RedirectMatch 301 ^/blog.html/(.*)$ http://abcd.com/blog/$1

这应该有效。

相关问题