0
如何將所有用戶從* .example.com和example.com重定向到foo.example.com?將* .example.com和example.com重定向到foo.example.com
我的服務器正在使用Apache。
如何將所有用戶從* .example.com和example.com重定向到foo.example.com?將* .example.com和example.com重定向到foo.example.com
我的服務器正在使用Apache。
假設您想將* .example.com/xyx重新路由到foo.example.com/xyz,您可以執行此操作。
RewriteEngine on
RewriteCond %{HTTP_HOST} !^foo\.example\.com$ [NC]
RewriteRule ^(.*)$ http://foo.example.com/$1 [R=301,L]
雖然我要指出,你可能要考慮通過DNS配置做這樣的域範圍內的重定向,如果它們指向一個網站上不同的IP地址。