我有domain.com和domain.org的别名指向同一个虚拟主机。我如何使用的.htaccess重定向所有domain.com请求domain.org?
I have domain.com and domain.org as aliases pointing to the same vhost. How can I use .htaccess to redirect all domain.com requests to domain.org?
您可以使用 mod_rewrite的做到这一点。
You could use mod_rewrite to do this.
RewriteEngine on
RewriteCond %{HTTP_HOST} !^example.org$
RewriteRule ^ http://example.org%{REQUEST_URI} [L,R=301]
该规则重定向每次不是给 example.org
到同样的要求。
This rule redirects every request that’s not addressed to example.org
to the very same.