I have two CentOS boxes running Apache. One is my dev environment and the other is my production environment. I am looking at using Gulp in a process of pushing from my dev server to my production server via Git, but have different configuration requirements in my .htaccess file based on the environment.
What I'd like to do is have some type of central configuration file that allows me to update these configurations and then when I push to dev it sets certain aspects of the .htaccess file to the dev settings and when pushed to production it uses my production settings.
(I guess the other option is to have a dev.htaccess and prod.htaccess and have Gulp just rename the appropriate file to .htaccess according to which environment it is pushing to. I'd like to avoid having to maintain multiple .htaccess files though.)
Best Answer
IMHO you should maintain your server configuration separate from your code.
Configuration management tooling should easily allow you to maintain the correct configuration for a specific environment and your code ought to be able to run in any correctly configured environment.
So don't include your
.htaccess
file in your deployment and preferably: do not use.htaccess
files at all!As quoted from from the manual on .htaccess files: