Regex htaccess端口转发URL

Regex htaccess端口转发URL,regex,apache,.htaccess,mod-rewrite,portforwarding,Regex,Apache,.htaccess,Mod Rewrite,Portforwarding,我希望安装2.htaccess重新写入,但不确定它们的实际外观: http://www.mysite.com -> http://www.myothersite.com:880 及 只是为了处理港口转运问题 以下是我目前正在尝试的: RewriteEngine on RewriteBase / RewriteCond %{HTTP_HOST} ^cloud\.mysite\.com$ [NC] RewriteCond %{HTTPS} off RewriteRule ^ http://

我希望安装2.htaccess重新写入,但不确定它们的实际外观:

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

只是为了处理港口转运问题

以下是我目前正在尝试的:

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,然后将此代码放入
文档根目录下的
.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]

谢谢我要试一试。假设我只想让这个应用于cloud.mysite.com,那么上面唯一会改变的就是“www”->“cloud”?所有其他访问我的网站的www都不会受到影响吗?是的,只需将
RewriteCond%{HTTP\u HOST}^(www\)?mysite\.com$[NC]
替换为
RewriteCond%{HTTP\u HOST}^cloud\.mysite\.com$[NC]
确保启用了mod u rewrite And.htaccess。如果是,那么在你的问题中发布你最新的.htaccess,并提供一些详细信息,比如什么URL不起作用。谢谢你的.htaccess,但是上面规则中的哪些URL不起作用?两个云URL都不起作用。URL没有被重新写入。他们只是保持不变。。。
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]