Subdomain stop auto-creating directory

dgware

Registered
May 28, 2010
4
0
51
I have a subdomain; xxx.domain.com which redirects to domain.com/xxx but it also keeps creating the xxx directory in public_html.

How do I stop the creating of this directory. When I delete it, it comes back after a week or so.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,268
463
Hello :)

Could you elaborate a little more on the existing configuration in place? You mentioned a redirect to a sub-directory, but then also mentioned deleting that same sub-directory. cPanel should not automatically create directories on it's own without you creating the subdomain in the UI. Do you have any other third-party applications or scripts installed that could be creating the directory?

Thank you.
 

dgware

Registered
May 28, 2010
4
0
51
Hello :)

Could you elaborate a little more on the existing configuration in place? You mentioned a redirect to a sub-directory, but then also mentioned deleting that same sub-directory. cPanel should not automatically create directories on it's own without you creating the subdomain in the UI. Do you have any other third-party applications or scripts installed that could be creating the directory?

Thank you.
I created a subdomain in the UI: xxx.domain.com and the directory as public_html
I then created a .htaccess file with the following content:

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


domain.com/xxx is not a directory, it's an application route. Cpanel automatically keeps creating the xxx directory which breaks the route.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,268
463
cPanel should not be automatically creating directories without user actions. Please open a support ticket using the link in my signature so we can take a closer look. You can post the ticket number here so we can update this thread with the outcome.

Thank you.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,268
463
To update, the user was recommended to modify the .htaccess and list owa as an application route. EX:

Code:
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} ^owa/
RewriteRule ^ index.php [L]
Thank you.