While adding a permanent 301 redirect to one of my old domains onto a new one hosted on a cpanel based server I encountered an error saying:
“There was an error adding the redirect.”
Redirecting “” to http://my-new-domain.com/ will cause a redirection loop because http://my-old-domain.com/ , which is located at “/domain/location/both/are/same/” is above “/domain/location/both/are/same/”.
Well if you read the error carefully, you can see that the reason for the redirect loop error is that both the domains, when added to addon domains (or sub domains) were having the files in same folder on the server.
So quite obviously, the solution is to change the folder path for the old domain from the new one.
The way I did it was, creating an entirely different folder for redirected domains on my server and point them to that folder in the addon domains / sub domains section and then add the redirect.
One more thing to make sure that the redirect is working fine is to add a trailing slash after the domain name “/”. Without it it might not give an error when you’re adding a 301 redirect on cpanel, but it will not work as per expected if you want a wildcard redirect.
It will work only on the main domain, but not on the wildcard redirect. If you’ll try to access the link directly it will give a “404 not found on server” error.
Hope it will help you solve your domains 301 redirect issues. Let me know if you want my help in fixing and setting up your 301 redirects for your domains or subdomains.