http > https for a host with multiple domains

Using a single web hosting account to host multiple sites

http > https for a host with multiple domains

Postby geniusman » Fri Oct 12, 2007 11:12 pm

Hello!

I am using a host provider where I have a big public_html directory and via CPanel can add on domain names. Those domain names function precisely as if they were hosted onto separate web servers. The files of those add on domain names could be found under public_html/name of the folder of my add on domain name.

In the main public_html directory I have a domain name installed by default. This domain name is using SSL. To make the http go to https I used:

RewriteEngine On
RewriteCond %{SERVER_PORT} !=443
RewriteRule ^ https://www.domain-name.com%{REQUEST_URI} [NS,R,L]

This works just fine but for the other add on domain names it does not. Namely:

When I type: www.domain-name.com I am redirected to https://www.domain-name.com

When I type www.add-on-domain.com I am redirected to https://www.domain-name.com as well.

What would you recommend me to do in order to have the domain-name.com redirect to https://www.domain-name.com and the add-on-domain-name.com redirect to its main web site http://www.add-on-domain.com.

Any comments or suggestions, especially from Richard would be highly appreciated. Thanks a lot in advance!
geniusman
 
Posts: 3
Joined: Fri Oct 12, 2007 10:39 pm

Postby richardk » Sat Oct 13, 2007 3:23 pm

So you want it to only work for your main domain? Try
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{HTTP_HOST} ^(www\.)?(domain-name\.com)$ [NC]
RewriteCond %{SERVER_PORT} !^443$
RewriteRule .* https://www.%2%{REQUEST_URI} [R=301,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 10 guests

cron