0

I want to forward the cpanel and webmail ports using .htaccess as follows:

www.mydomain.com:2082 -> www.sharedserver.com:2083

I tried the following but it doesn't seem to work:

RewriteCond %{HTTP_HOST} ^(www.mydomain.com):2082$ [NC,OR]
RewriteCond %{HTTP_HOST} ^(www.mydomain.com):2083$ [NC]
RewriteRule ^(.*)$ https://www.sharedserver.com:2083 [L,R=302]
4

2 回答 2

0

尝试这个

 RewriteCond %{SERVER_NAME} ^2082$
 RewriteRule .* https://www.sharedserver.com:2083 [L,R]

检查此以供参考:http ://www.askapache.com/htaccess/ssl-example-usage-in-htaccess.html

于 2012-10-04T04:50:02.983 回答
0

不保证端口是“主机:”请求标头的一部分。您可以匹配%{SERVER_PORT}处理请求的 vhost/host 端口的变量:

RewriteCond %{HTTP_HOST} ^www.mydomain.com$ [NC]
RewriteCond %{SERVER_PORT} ^2082$
RewriteRule ^(.*)$ https://www.sharedserver.com:2083/$1 [L,R=302]
于 2012-10-04T05:39:18.360 回答