Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试重定向到新域并包含子域...
例如http://somesub.olddomain.com/someuri应该重定向到http://somesub.newdomain.com/someuri
谁能指出我正确的方向?
谢谢!
.htaccess在您的旧子域域上创建一个,例如:
.htaccess
RewriteEngine on RewriteRule ^(.*)$ http://somsub.newdomain.com/$1 [R=301,L]
或者,对于特定域的所有子域,规则将是:
RewriteCond %{HTTP_HOST} ^([^.]+\.){0,1}olddomain\.com [NC] RewriteRule ^(.*)$ http://{%1}newdomain.com/$1 [R=301,L]