我将domain.com 和domain.org 作为指向同一虚拟主机的别名。如何使用 .htaccess 将所有domain.com 请求重定向到domain.org?
你可以使用模组重写 http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html去做这个。
RewriteEngine on
RewriteCond %{HTTP_HOST} !^example\.org$
RewriteRule ^ http://example.org%{REQUEST_URI} [L,R=301]
此规则重定向每个未发送到的请求example.org
完全相同。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)