![](/img/trans.png)
[英]301 redirect url with all url's that start with main url - Wordpress
[英]301 Redirect all subdomain URL's to specific URL
我的客戶有一堆特定於位置的子域站點,但是我們將它們合並到一個站點中並創建了單獨的辦公頁面。 有人可以幫我解決301,將所有location1.example.com URL重定向到example.com/location1等嗎?
在root / .htaccess中嘗試一下
RewriteEngine On
RewriteCond %{HTTP_HOST} ^location1\.example\.com$ [NC]
RewriteRule ^(.*)$ http://example.com/location1/$1 [NC,L,R]
您可以在文檔根目錄的.htaccess中嘗試一下。 這會將您的任何子域轉換為子文件夾。
RewriteEngine On
RewriteCond %{HTTP_HOST} ^((?!www).+)\.example\.com$ [NC]
RewriteRule ^(.*)$ http://example.com/%1/ [R=301,L]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.