0

我正在寻找设置 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]
4

1 回答 1

0

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

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]
于 2012-12-11T15:46:29.897 回答