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.

Need help with 301 https redirection

Discussion in 'Security' started by skizo, Jan 27, 2017.

  1. skizo

    skizo Member

    Joined:
    Dec 24, 2012
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Reseller Owner
    Hello. I have upgrade my WHM/CPANEL with AutoSSL and Lets encripted features. I have several cpanel accounts with joomla installations, and I do not know how to setup 301 redirections for google seo good practices.

    Before, I had this htaccess redirection for www to non-www:

    Code:
    RewriteCond %{HTTP_HOST} ^www.mysite.com [NC]
    RewriteRule ^(.*)$ http://mysite.com/$1 [L,R=301]
    After AUTOSLL LETS ENCRIPTED, I Have:

    Code:
    RewriteCond %{HTTP_HOST} ^www.mysite.com [NC]
    RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
    RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
    RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
    RewriteRule ^(.*)$ http://mysite.com/$1 [L,R=301]
    NOW, I Need to setup redirections 301 for google search links, http-non-www to https-non-www

    This is a combination of rules.

    Is correct in this way (duplicate)?:

    Code:
    RewriteCond %{HTTP_HOST} ^www.mysite.com [NC]
    RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
    RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
    RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
    RewriteRule ^(.*)$ https://mysite.com/$1 [L,R=301]
    
    RewriteCond %{HTTP_HOST} ^mysite.com [NC]
    RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
    RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
    RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
    RewriteRule ^(.*)$ https://mysite.com/$1 [L,R=301]
    BESIDES of this, in joomla server configuration I force SSL use ┬┐Is this another duplication?
    Thanks!
     
  2. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    15,623
    Likes Received:
    296
    Trophy Points:
    433
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    Are you trying to manually add this or are you using the Redirects area of your cPanel?
     
Loading...

Share This Page