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!

There was an error adding the redirect

Discussion in 'General Discussion' started by toplisek, Apr 11, 2018.

  1. toplisek

    toplisek Well-Known Member

    Joined:
    Jan 7, 2010
    Messages:
    124
    Likes Received:
    6
    Trophy Points:
    68
    1. Redirecting inside Control panel shows me an error message:
    There was an error adding the redirect.

    Redirecting "" to "Example Domain" will cause a redirection loop because "Example Domain", which is located at "/home/XXX/public_html/", is above "Example Domain", which is located at "/home/XXX/public_html/" .

    I try to create redirect using HTTACCES and Control panel in the correct way:
    1. HTTP into HTTPS
    2. Example Domain to Example Domain
    3. www.example.com/ to Example Domain
    4. example.com to Example Domain

    Which settings should be done as there is an error message as I have left field /

    2. Redirecting using Htaccess
    RewriteEngine
    RewriteCond %{HTTPS} off
    RewriteCond %{SERVER_PORT} 443
    RewriteCond %{HTTP_HOST} ^example.com$
    RewriteRule ^(.*)$ https://www.example.com/$1 [R=301]
    Options +FollowSymlinks

    Is this the correct way and
    1. www.example.com
    2. Example Domain
    3. example.com
    will work to Example Domain

    Need help.
     
    #1 toplisek, Apr 11, 2018
    Last edited: Apr 11, 2018
  2. cPanelLauren

    cPanelLauren Forums Analyst
    Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    1,424
    Likes Received:
    98
    Trophy Points:
    103
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    Hi @toplisek

    Can you clarify specifically what you're trying to achieve? Based on the rewrite you've provided you're attempting to create a wildcard redirect for example.com -> Example Domain

    Please keep in mind that checking a wild card redirect will redirect all files within a directory to the same filename in the redirected directory - if you're just attempting to force a redirection to SSL the redirect when created inside the cPanel UI looks as follows in the .htaccess:


    Code:
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^example\.com$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.example\.com$
    RewriteRule ^/?$ "https\:\/\/www\.example\.com\/" [R=301,L]

    Thank you,
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. toplisek

    toplisek Well-Known Member

    Joined:
    Jan 7, 2010
    Messages:
    124
    Likes Received:
    6
    Trophy Points:
    68
    It works your script.Thank you. I have tested again.
    But an issue that testing and modified HTTPS into HTTP will redirect to www.example.com and it will not be forced into Example Domain
    It seems that forced HTTPS is not enabled as it should force to HTTPS and redirect to Example Domain even I manuall ychange to HTTP inside URL. Can be achieved this? Chrome will work but Mozilla not even developer edition.
     
    #3 toplisek, Apr 13, 2018
    Last edited: Apr 13, 2018
  4. cPanelLauren

    cPanelLauren Forums Analyst
    Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    1,424
    Likes Received:
    98
    Trophy Points:
    103
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    Hello,

    To clarify you're indicating that when adding the redirect as noted above to redirect example.com and www.example.com to https it is not redirecting in Firefox?

    I am unsure what would cause that behavior but I would assume that there is caching occurring. If this behavior persists after clearing the cache please use the link in my signature to open a ticket so that we can take a closer look.


    Thank you,
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. toplisek

    toplisek Well-Known Member

    Joined:
    Jan 7, 2010
    Messages:
    124
    Likes Received:
    6
    Trophy Points:
    68
    Thank you. We will open a ticket.
     
  6. cPanelLauren

    cPanelLauren Forums Analyst
    Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    1,424
    Likes Received:
    98
    Trophy Points:
    103
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    Thank you please post the ticket ID here so that we can update this thread with the outcome.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice