我希望设置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]
答案 0 :(得分:0)
通过httpd.conf
启用mod_rewrite和.htaccess,然后将此代码放在.htaccess
目录下的DOCUMENT_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]