簡體   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