[英]Regex to redirect 301 a folder and all posts from that folder in Wordpress
刚刚将我的网站从www.example.com/blog
移到了www.example.com
。
我需要向我的.htaccess
添加301重定向,以将使用www.example.com/blog/...
网址调用的所有内容重定向,例如将www.example.com/blog/category
重定向至www.example.com/category
或www.example.com/blog/post-title
到www.example.com/post-title
。
我已经重定向了该文件夹,但是它似乎不起作用。 你能帮助我吗?
这是文件夹301的代码:
RewriteEngine On
RewriteRule ^blog(/.*)?$ /$1 [L,NC,NE,R=301]
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-
RewriteRule ^blog(/.*)?$ /$1 [L,NC,NE,R=301]
RewriteRule ^index\.php$ - [L]
RewriteRule . /index.php [L]
在您的网站根目录.htaccess中,顶部具有以下规则:
RewriteEngine On
RewriteRule ^blog(/.*)?$ https://%{HTTP_HOST}/$1 [L,NC,NE,R=301]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.