如何通过htaccess从一个http域重定向到另一个https域?

如何通过htaccess从一个http域重定向到另一个https域?

问题描述:

I want to redirect

http://abc.one.com/mysettings/marks

to

https://xyz.two.com/mysettings/marks

I added below lines htaccess file but it doesn't seem to work. Please let me know where am I going wrong.

RewriteCond %{HTTP_HOST} ^http://abc.one.com/mysettings/marks [NC]
RewriteRule ^(.*)$ https://xyz.two.com/mysettings/marks [L,R=301]

我想重定向 p>

  http:// abc。  one.com/mysettings/marks

to

https://xyz.two.com/mysettings  / marks 
  code>  pre> 
 
 

我在htaccess文件下面添加了行,但它似乎不起作用。 请告诉我哪里出错了。 p>

  RewriteCond%{HTTP_HOST} ^ http://abc.one.com/mysettings/marks [NC] 
RewriteRule ^(  。*)$ https://xyz.two.com/mysettings/marks [L,R = 301] 
  code>  pre> 
  div>

You can use;

RewriteCond %{HTTP_HOST} ^abc\.one\.com$ [NC]
RewriteRule ^mysettings/marks/?$ https://xyz.two.com/mysettings/marks [L,R=301]

Don't use URI in HTTP_HOST condition.

Also use 301 redirect method. Because Redirect 301 /old-page.html http://www.example.com/new-page.html