[英]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.