cPanel redirect tool is errant - redirect loop error

jols

Well-Known Member
Mar 13, 2004
1,107
3
168
This did not used to be the case. But now if you use the cPanel redirects tool to redirect traffic to a subdirectory you will get a redirect loop error.

Here are the results of using the redirect tool that show up in the root web .htaccess file:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^.*$ "http\:\/\/www\.domain\.com\/subdirectory\/" [R=301,L]


To avoid the redirect loop error, I have to manually change the above to the following:

RewriteEngine On
RewriteCond %{HTTP_HOST}%{REQUEST_URI} ^domain.com/$ [NC,OR]
RewriteCond %{HTTP_HOST}%{REQUEST_URI} ^www.domain.com/$ [NC]
RewriteRule ^(.*)$ http://www.domain.com/subdirectory/$1 [r=301,nc]


This of course leads to a number of unnecessary support calls throughout the week when our hosted customers try to do the redirect using the cPanel tool. Can anyone here suggest a resolution for a fix? Should I make a bug report or something like that? Or, is there a control or parameter file we can edit so that these redirects do not end up in loops?