0
我有一个需要匹配部分域名的正则表达式,并重定向到一个不同的域,匹配的部分是文件名的一部分。如何在RewriteRule中使用RewriteCond HTTP_HOST的匹配部分?
例,在this-is.com htaccess的:
this-is-a-test.com redirects to this-is.com/test.htm
this-is-a-fish.com redirects to this-is.com/fish.htm
this-is-a-duck.com redirect to this-is.com/duck.htm
到目前为止,我已经试过如下:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^this-is-a-(.*).com$
RewriteRule (.*) http://this-is.com/test.htm [L]
但是,这并不工作,作为重写规则只处理查询字符串部分而不是主机部分。
如何在RewriteRule中使用RewriteCond的匹配部分?
那些是你希望重定向单独的域? – JCSickmeyer