BUG: Cpanel added domain "redirect" based on incorrect understanding of the .htaccess file.

RickKukiela

Active Member
Jan 17, 2017
32
15
58
Chicago
cPanel Access Level
Root Administrator
The following lines from the .htaccess file in the document root for one of my sites were:

RedirectMatch 301 ^/path/to/template/folder/?$ https://www.maindomain.com
RedirectMatch 301 ^/path/to/template/folder/some-template.php$ https://www.maindomain.com

These lines were apparently interpreted as "redirect this domain to http://www.maindomain.com/^/path/to/template/folder/?" and also "redirect this domain to http://www.maindomain.com/^/path/to/template/folder/some-template.php"

Both of those redirects were added to the "redirects" section of the "domains" section of the cpanel account for the domain in question. Also the domains list had the main domian listed as "redirected" to that obviously invalid URL.

The bug? .... That interpretation is NOT correct at all!

Those lines were saying to redirect requests to that template folder path and specifically that some-template.php file in that folder back to the root domain (in effort to lock them from direct access).

I know these redirects were added because of these lines in the .htaccess file because when I went into the redirects section of the cpanel for the account and removed them, the two corresponding lines were removed from the .htaccess file which proves they are correlated.

I have since placed a "deny from all" .htaccess file in that folder so I do not need the redirects to exist in the main .htacceess file any longer. This is clearly a bug in the cpanel code as it completely misunderstood what those lines were doing, added multiple bad redirects into the domain configuration in cpanel based on that misunderstanding.

I do not know if that "redirect" being listed there in the redirects was actually doing anything or was just "informational" since I discovered this and removed them while investigating another issue caused by corruption in our httpd.conf. If this was unrelated to the corruption issue and not related to the site being down It may have just been "informational" thereby attempting to relay information it read in the .htaccess file in cpanel so that makes the bug not as severe in that case, but it's still saying something completely wrong in this context.
 

quietFinn

Well-Known Member
Feb 4, 2006
2,109
580
493
Finland
cPanel Access Level
Root Administrator
I know these redirects were added because of these lines in the .htaccess file because when I went into the redirects section of the cpanel for the account and removed them, the two corresponding lines were removed from the .htaccess file which proves they are correlated.
I added redirects to .htaccess manually, and I could see them in cPanel redirects.
I removed them in cPanel and they were removed from .htaccess.

The facts that they show up in cPanel proves nothing.
 

RickKukiela

Active Member
Jan 17, 2017
32
15
58
Chicago
cPanel Access Level
Root Administrator
I added redirects to .htaccess manually, and I could see them in cPanel redirects.
I removed them in cPanel and they were removed from .htaccess.

The facts that they show up in cPanel proves nothing.
Do you know you just repeated what I said but just came to the wrong conclusion?

You added redirects to htaccess, saw them in cpanel.
You removed said redirects in cpanel and that removed them from .htaccess.

That is the literal definition of correlation.

The bug is that the cpanel is not saying the correct thing. Cpanel was saying that the entire domain redirects to a non-sensical URL, when in reality a sub-path on the domain was redirecting requests back to the top level of the domain. The domain itself was not redirecting anywhere as cpanel was saying.