繁体   English   中英

htaccess端口转发URL

[英]htaccess port forwarding URLs

我正在寻找设置2 .htaccess的重写,但是不确定它们的实际外观:

http://www.mysite.com -> http://www.myothersite.com:880

https://www.mysite.com -> https://www.myothersite.com:4443

只是为了处理端口转发问题...

这是我目前正在尝试的方法:

RewriteEngine on
RewriteBase /

RewriteCond %{HTTP_HOST} ^cloud\.mysite\.com$ [NC]
RewriteCond %{HTTPS} off
RewriteRule ^ http://mysite.no-ip.org:880%{REQUEST_URI} [R=301,L]

RewriteCond %{HTTP_HOST} ^cloud\.mysite\.com$ [NC]
RewriteCond %{HTTPS} on
RewriteRule ^ https://mysite.no-ip.org:4443%{REQUEST_URI} [R=301,L]

RewriteCond %{HTTP_HOST} ^mysite\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.mysite\.com$
RewriteRule ^/?$ "http\:\/\/www\.mysite\.com\/joomla" [R=301,L]

通过httpd.conf启用mod_rewrite和.htaccess,然后将此代码放在DOCUMENT_ROOT目录下的.htaccess

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} ^(www\.)?mysite\.com$ [NC]
RewriteCond %{HTTPS} off
RewriteRule ^ http://www.myothersite.com:880%{REQUEST_URI} [R=301,L]

RewriteCond %{HTTP_HOST} ^(www\.)?mysite\.com$ [NC]
RewriteCond %{HTTPS} on
RewriteRule ^ https://www.myothersite.com:4443%{REQUEST_URI} [R=301,L]

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM