.htaccess is being overwritten by version control. Solutions to prevent this?


Well-Known Member
Mar 25, 2002

For the second time in a month or so, a client of ours has reported that the URL redirects he setup in cPanel have disappeared.

The answer: both times we patched the (Drupal) site using version control, and this caused the .htaccess file to get overwritten.

The challenge here is that, ideally, or at least from a version control perspective, clients shouldn't be allowed to make file changes to the live site. And yet, when they make use of the cPanel feature that allows them to setup URL redirects (and doubtless some other cPanel features), they get to, unwittingly, make file changes directly to the live version of their site.

We could remove this (and other) features from cPanel that allows them to do this. But we don't think this is reasonable, because some clients want the freedom to do this themselves.

So perhaps we have to change the way we manage version control?

How have others addressed this issue please?



p.s. For this particular client we've implemented a workaround which we think is solid: we moved the subdomain (that was being redirected from) outside of the public_html folder, then re-added the redirects. But that's a very specific solution for this client. We need a more general purpose solution for all clients.


Staff member
Apr 11, 2011
Hello @spaceman,

We'll begin adding support for Git version control in cPanel & WHM version 72. You can read more about this under "Best Answer" in the comments section of the following feature request:

Allow users to install websites from version control

Let us know if you have any questions about how this will work.