Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


  Search this Thread
Old 09-09-2011, 10:28 PM   #1
Registered: Sep 2011
Distribution: Fedora release 21 (Twenty One)
Posts: 156

Rep: Reputation: 19
redirect to


I have ssl installed on my site.It works when I browse https:// . But when some one browse , it gives invalid certificate error. So I need to redirect from to Any help is appreciated .

Old 09-10-2011, 02:45 AM   #2
Registered: Apr 2011
Distribution: Slackware64-current
Posts: 65

Rep: Reputation: 12
If you have apache/mod_rewrite installed put this in your .htaccess
<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteCond %{HTTP_HOST} ^www\.domain\.com$ [NC]
  RewriteRule ^(.*)$$1 [L,R=301]
Otherwise you can use php in this way:

if ($_SERVER['HTTP_HOST']=='')

Last edited by roberto967; 09-10-2011 at 02:46 AM.
Old 09-10-2011, 05:17 AM   #3
Registered: Sep 2011
Posts: 52

Rep: Reputation: Disabled
you will get the certificate warning anyway because the mod_rewrite redirect rules are executed after you hit the certificate for https://

unfortunately there's no workaround for this and the only way is to get a certificate for *


Last edited by zackwasa; 01-12-2012 at 12:54 AM.
Old 09-10-2011, 05:27 AM   #4
LQ Newbie
Registered: Sep 2011
Posts: 5

Rep: Reputation: Disabled
zackwasa is correct that using the rewrite rule will not fix issue as people will still have to connect to the server via HTTPS to get the rewrite rule. There is a way to get more than 1 CN assigned to a single SSL certificate. So for example a single SSL certificate would work for both and I don't remember the process for this off hand, but you will probably have to generate a new key / csr and send that to your signer and have them resign the cert.
Old 09-13-2011, 10:05 AM   #5
Registered: Sep 2011
Distribution: Fedora release 21 (Twenty One)
Posts: 156

Original Poster
Rep: Reputation: 19
Ok. Thanks.I will better install ssl for too.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
apache 2.0 https to https redirect struct Linux - Software 1 04-22-2011 05:43 PM
[SOLVED] https and http for one domain name yoachan Linux - Server 4 03-13-2011 06:52 AM
[SOLVED] redirect https non-www Apache rahmad Linux - Server 13 04-20-2010 02:12 AM
Apache https redirect without-www to with-www alitrix Linux - Server 3 07-24-2008 06:11 AM
one domain on 443 and other on 80 but https on 80 domain need to be stopped majid Linux - General 0 08-30-2006 07:24 PM

All times are GMT -5. The time now is 12:42 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration