Home Apache & HTTPS : Htaccess 301 Redirection on multi domain website
Reply: 1

Apache & HTTPS : Htaccess 301 Redirection on multi domain website

Sydowh
1#
Sydowh Published in 2018-01-12 14:01:49Z

I use, on my website two domains, files are on a same folder

root/index1.php  

is main page of http://domain1.xyz

And

root/index2.php

is main page of http://domain2.xyz

I need to force Apache to redirect all http:// on https:// on both domain

I know I can use on .htaccess :

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://domain1.xyz/$1 [R=301,L]

For a unique domain but I can't find a solution for two

starkeen
2#
starkeen Reply to 2018-01-12 14:44:39Z

Replace your domainname with % {HTTP_HOST } .

 RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.301798 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO