If this is a duplicate, please mark it is as so. Also, I'm not exactly sure if this would be an opinion-based question. My googling has not returned anything relevant to my predicament, and I'm not sure what I should be googling either. (1, 2)
My question is about how to keep a production .htaccess file that is tracked in git from interfering with my development environment's web server.
A brief description of my git deployment setup:
Local machine (dev) -> Bitbucket -> Production
Production is on a shared host, so I can't directly push to production from dev, I have to use Bitbucket as an intermediary.
My development environment:
I use Vagrant locally as my development environment, which uses Apache as its web server. The vagrantbox setup script applies changes in the httpd.conf file to set up the VirtualHost, DocumentRoot and DirectoryIndex.
This has worked fine for me in the past.
On production, Apache is also used. I originally did not have .htaccess tracked in git, but there was a change recently (an HTTP to HTTPS redirect) that made me decide to start tracking it. The problem I have now is that the production .htaccess file is getting pulled to my dev directory and affecting my dev web server.
A few ideas I had were:
- Creating a separate git repo to track the
.htaccessfile on production that will not be added to Bitbucket or dev, but this feels convoluted to me. - Creating a branch to track the
.htaccessfile but ... I foresee that getting messy for me because I'll be juggling branches on prod/dev and there's a strong chance I'd screw something up. - I forego tracking the
.htaccessfile altogether, but that seems like a recipe for disaster later on.
Is there another way to do this? Or should I use one of the ideas I thought of?