1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

.htaccess to redirect non-www to www and then to https

Discussion in 'Apache' started by toniya, Aug 10, 2012.

  1. #1
    Hello,

    Following is my .htaccess file

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^domain.com
    RewriteRule (.*) http://www.domain.com/$1 [R=301,L]

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

    I am trying to redirect non-www http://domain.com and https://domain.com and http://www.domain.com to > https://www.domain.com

    But it is not happening? what is wrong?
    Thanks for the help
    Toniya
     
    toniya, Aug 10, 2012 IP
  2. bestemployer

    bestemployer Peon

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #2
    Do you have .htaccess files enabled in your httpd.conf?
    Is mod_rewrite working?
    Also, you can try appending to your httpd.conf:
    Redirect permanent / https-link
    (change https-link to full link to www website with https)
     
    bestemployer, Aug 17, 2012 IP