Multiple domains to one secured HTTPS domain

Fix it!!

Multiple domains to one secured HTTPS domain

Postby squeezer » Fri Aug 24, 2007 6:06 am

Hello everybody.
I have some domains: abc.com, efg.com, hij.com ...
These domains all point to the same IP adress and are aliases for
abc.com

Now I want to redirect all the domains to https://www.abc.com

I am new to mod_rewrite and I have already read some threads in this forum, but I didn't exactly found what I was looking for.

I need to do this, because I have one SSL certificate for www.abc.com, and I do not want to get certificate missmatches if a user goes to efg.com for example.

Thanks for your help!

Marc
squeezer
 
Posts: 1
Joined: Fri Aug 24, 2007 6:01 am

Postby richardk » Fri Aug 24, 2007 10:34 am

Do they all have the same document root?

Try the following in a .htaccess file in the document root(s)
Code: Select all
Options +FollowSymLinks

RewriteEngine On

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

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


Return to Security with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 17 guests

cron