The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

.htaccess redirect

Discussion in 'General Discussion' started by 'Giovanni, Apr 16, 2014.

  1. 'Giovanni

    'Giovanni Member

    Joined:
    Feb 13, 2008
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    I want to do a .htaccess redirect from https to http and from non www to www, can anyone help me with the correct code?
     
  2. vanessa

    vanessa Well-Known Member
    PartnerNOC

    Joined:
    Sep 26, 2006
    Messages:
    817
    Likes Received:
    22
    Trophy Points:
    18
    Location:
    Virginia Beach, VA
    cPanel Access Level:
    DataCenter Provider
    To force http:

    Code:
    RewriteEngine On
    RewriteCond %{HTTPS} on
    RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI}
    
    To force www:

    Code:
    Options +FollowSymlinks
    RewriteEngine On
    RewriteCond %{http_host} ^domain.com [NC]
    RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]
    
     
  3. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    675
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
  4. 'Giovanni

    'Giovanni Member

    Joined:
    Feb 13, 2008
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    It does the redirect on http from non www to www but on ssl if i access https:// domain.com it redirects me to another domain (not domain.com) and for https:// www. domain.com it shows the warrning atempt reach etc. and if i proceed, again goes to other domain

    :confused:
     
  5. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    675
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    Are you sure a valid SSL certificate has been installed for this domain name, and it's not utilizing another certificate for another domain on a shared IP address?

    Thank you.
     
Loading...

Share This Page