Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

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.

Redirect not working

Discussion in 'General Discussion' started by k2tec, Aug 30, 2017.

  1. k2tec

    k2tec Well-Known Member

    Joined:
    Aug 26, 2011
    Messages:
    98
    Likes Received:
    3
    Trophy Points:
    58
    Location:
    Netherlands
    cPanel Access Level:
    Root Administrator
    • CENTOS 6.9
    • v66.0.15
    I placed a redirect in cPanel:
    Domain - Directory - Redirect Url - Type Match
    mydomain.com mydomain.com/ariston-velis/Wesen-ECO-80-Elektrische-boiler permanent

    This is my htaccess
    Code:
    RewriteOptions inherit
    # 1.To use URL Alias you need to be running apache with mod_rewrite enabled.
    
    # 2. In your opencart directory rename htaccess.txt to .htaccess.
    
    # For any support issues please visit: http://www.opencart.com
    
    Options +FollowSymlinks
    
    # Prevent Directoy listing
    Options -Indexes
    
    # Prevent Direct Access to files
    <FilesMatch "(?i)((\.tpl|\.ini|\.log|(?<!robots)\.txt))">
     Order deny,allow
     Deny from all
    </FilesMatch>
    
    # SEO URL Settings
    RewriteEngine On
    
    RewriteBase /
    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 ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
    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 ^googlebase.xml$ index.php?route=feed/google_base [L]
    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 ^download/(.*) /index.php?route=error/not_found [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
    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 ^([^?]*) index.php?_route_=$1 [L,QSA]
    
    RewriteCond %{HTTP_HOST} ^www\.mydomain\.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://mydomain.com/$1 [L,R=301]
     
     
    RewriteCond %{HTTPS} off
    RewriteCond %{REQUEST_URI} !^/\d+\.BIN_AUTOSSL_CHECK_PL__\.\w+\.tmp$ [NC]
    RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/ [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://%{HTTP_HOST}%{REQUEST_URI}
    
    RewriteCond %{HTTP_HOST} ^mydomain\.com$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.mydomain\.com$
    RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
    RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
    RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
    RewriteRule ^ariston\-velis\/Wesen\-Inox\-Flat\-80\-liter\-elektrische\-boiler$ "https\:\/\/mydomain\.com\/ariston\-velis\/Wesen\-ECO\-80\-Elektrische\-boiler" [R=301,L]
     
    #1 k2tec, Aug 30, 2017
    Last edited by a moderator: Aug 30, 2017
  2. Eminds

    Eminds Well-Known Member

    Joined:
    Nov 10, 2016
    Messages:
    204
    Likes Received:
    12
    Trophy Points:
    18
    Location:
    India
    cPanel Access Level:
    Root Administrator
    If you have a root access of the server try to check the error logs at /usr/local/apache/logs/error_log
     
  3. k2tec

    k2tec Well-Known Member

    Joined:
    Aug 26, 2011
    Messages:
    98
    Likes Received:
    3
    Trophy Points:
    58
    Location:
    Netherlands
    cPanel Access Level:
    Root Administrator
    Thanks for the reply.
    Nothing special in the error log. It example.com/ariston-velis/Wesen-Inox-Flat-80-liter-elektrische-boiler gifs me a product not found in the shop that is OK because the product is not there anymore, but it has to direct it to example.com/ariston-velis/Wesen-ECO-80-Elektrische-boiler
     
    #3 k2tec, Aug 30, 2017
    Last edited by a moderator: Aug 30, 2017
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,127
    Likes Received:
    1,366
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    It looks like you have multiple redirect rules in the .htaccess file. Can you try disabling those rules first to make sure they are not conflicting with your new redirect rule? Note the following option is available under the "Domains" tab in "WHM >> Tweak Settings" if you want remove your existing AutoSSL exclusions:

    Use a Global DCV Passthrough instead of .htaccess modification (requires EA4)

    Thank you.
     
  5. k2tec

    k2tec Well-Known Member

    Joined:
    Aug 26, 2011
    Messages:
    98
    Likes Received:
    3
    Trophy Points:
    58
    Location:
    Netherlands
    cPanel Access Level:
    Root Administrator
    Thanks Michael,
    Use a Global DCV Passthrough instead of .htaccess modification (requires EA4) is on.

    But I can't play with anymore the customer installed a module in his shop. But I will try it next time when I encounter the same problem.
     
    cPanelMichael likes this.
Loading...

Share This Page