There was an error adding the redirect

toplisek

Well-Known Member
Jan 7, 2010
165
9
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.
 
Last edited:

cPanelLauren

Forums Analyst II
Staff member
Nov 14, 2017
7,907
625
263
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,
 

toplisek

Well-Known Member
Jan 7, 2010
165
9
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.
 
Last edited:

cPanelLauren

Forums Analyst II
Staff member
Nov 14, 2017
7,907
625
263
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,