繁体   English   中英

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

[英]htaccess redirect subdirectory to another subdirectory

由于 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 文件是不同的。

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

这应该有效。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM