Apache mod_重写规则作为子域
这怎么可能 改写为:Apache mod_重写规则作为子域,apache,mod-rewrite,Apache,Mod Rewrite,这怎么可能 改写为: 通过mod_rewrite?您可以在some-url.com的VirtualHost配置文件中将所有可能的语言特定子域定义为ServerAlias,并添加以下rewrite规则 RewriteEngine On RewriteCond %{HTTP_HOST} ^some-url\.com$ [NC] RewriteCond %{QUERY_STRING} lang=(.*)$ RewriteRule . http://%1.some-domain.com/? [R=3
通过mod_rewrite?您可以在some-url.com的VirtualHost配置文件中将所有可能的语言特定子域定义为ServerAlias,并添加以下rewrite规则
RewriteEngine On
RewriteCond %{HTTP_HOST} ^some-url\.com$ [NC]
RewriteCond %{QUERY_STRING} lang=(.*)$
RewriteRule . http://%1.some-domain.com/? [R=301,L]
在服务器端脚本中,您可以通过检查名为HTTP_HOST的SERVER/CGI变量(在php中,这将是$\u SERVER['HTTP_HOST']
,而在ColdFusion中,这将是#CGI.HTTP_HOST
)