我想使用.htaccess转发cpanel和webmail端口,如下所示:
www.mydomain.com:2082 - > www.sharedserver.com:2083
我尝试了以下但它似乎不起作用:
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]
答案 0 :(得分:0)
试试这个
RewriteCond %{SERVER_NAME} ^2082$
RewriteRule .* https://www.sharedserver.com:2083 [L,R]
选中此项以供参考:http://www.askapache.com/htaccess/ssl-example-usage-in-htaccess.html
答案 1 :(得分:0)
不保证端口是“Host:”请求标头的一部分。您可以匹配%{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]