Jump to content

.htaccess versioning


dhinged

Recommended Posts

We have a developer who wants to put .htaccess in git repo versioning but I argue that the file may not be the same across all server instances, especially localhost. He says that if your .htaccess file isn't the same in all instances you're doing something wrong. Can someone please explain this to me? I've worked on several sites that required different configurations for different uses and while maybe there's different ways to do this it seems like unnecessary work.

Edited by dhinged
Link to comment
Share on other sites

You're both right/wrong. Next.

 

There's no reason why the "common" parts could not be versioned in one file, and the server/site/whatever-specific parts (which could probably also be versioned too!) could not be added to the file during the build/deploy phase.

Edited by salathe
Link to comment
Share on other sites

For things like this what I do is store a base version which then would be copied over to the real version in each environment and customized for that environment.  The real version gets put on the ignore list to prevent it getting added to the repo.

 

Eg, for my site config files, I'd have a file in the repo that is named: config.inc.php.base which contains all the config directives w/ default or empty values.  Then whenever setting up an environment that file is just copied to config.inc.php and customized with the proper values.

 

The same concept could be applied to your .htaccess file, or any other files that need site-specific changes.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.