简体   繁体   English

如何将一个域的所有请求(http和https)重定向到另一个域

[英]How to Redirect One Domain's All Requests (http and https) to Another Domain

I have two domains installed on different serverpilot accounts. 我在不同的serverpilot帐户上安装了两个域。 domains are moviesky.in(abc) and moviesky.info (xyz) So , can u somebody tell me that how can i redirect both http and https (non www & www) request from abc to https xyz (even all other requests of xyz ie https xyz , xyz and www version of xyz ) 域是moviesky.in(abc)和moviesky.info(xyz),所以,您能告诉我如何将abc和HTTP(非www&www)请求从abc重定向到https xyz (甚至xyz的所有其他请求)即https xyz ,xyz和www版本的xyz

Should be redirected to https moviesky info. 应该重定向到https moviesky信息。 I mean to say that the destination URL from both domains should be only https moviesky info 我的意思是说来自两个域的目标URL应该仅是https moviesky信息

( When I installed Cloudflare SSL on my site it automatically redirects HTTP request to HTTPS on both domains) (在我的网站上安装Cloudflare SSL时,它会自动将HTTP请求重定向到两个域上的HTTPS)

Please somebody help me 请有人帮我

In the web root folder of moviesky.in, create a file called .htaccess (If this file already exists, edit/append it). 在moviesky.in的Web根文件夹中,创建一个名为.htaccess的文件(如果此文件已存在,请编辑/附加)。

Place the following in the file: 将以下内容放入文件中:

RewriteEngine On

RewriteCond %{HTTP_HOST} ^moviesky.in [NC]
RewriteRule ^(.*)$ https://www.moviesky.info/$1 [L,R=301]

Similarly, in the web root of moviesky.info, add (to .htaccess): 同样,在moviesky.info的Web根目录中,添加(到.htaccess):

RewriteEngine On

RewriteCond %{HTTP_HOST} ^moviesky.info [NC]
RewriteRule ^(.*)$ https://www.moviesky.info/$1 [L,R=301]

That should give you the desired results. 那应该给您期望的结果。

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

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