2017-08-07 177 views
2

試圖在合併之後讓舊站點重定向到新站點。Apache .htaccess重寫規則

blog.example.com到 - > store.example.com/blog

#Options +FollowSymLinks 
RewriteEngine on 
RewriteRule (.*) https://store.example.com/$1 [R=301,L] 
RewriteRule ^$ /blog [L] 

我缺少什麼?

回答

1

一個重寫規則應該足夠了:

RewriteEngine on 
RewriteRule ^(.*)$ https://store.example.com/blog/$1 [NE,L,R=301] 
+0

是重定向到https://store.example.com/不https://store.example.com//blog – Joe

+0

然後,你必須把它弄壞了複製?這裏是在線測試你可以嘗試:http://htaccess.mwl.be/ –

+0

謝謝,我幫了我很多,得到它與您的原始代碼工作 – Joe