Jump to content


.htaccess versioning

  • Please log in to reply
2 replies to this topic

#1 dhinged

  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 17 February 2013 - 06:40 PM

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, 17 February 2013 - 06:42 PM.

#2 salathe

  • Staff Alumni
  • Badger
  • 1,860 posts
  • LocationEdinburgh, Scotland

Posted 17 February 2013 - 06:55 PM

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, 17 February 2013 - 06:57 PM.

PHP Documentation Team

#3 kicken

  • Gurus
  • Wiser? Not exactly.
  • 3,280 posts
  • LocationBonita, FL

Posted 17 February 2013 - 08:30 PM

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.

Recycle your old CD's, don't trash them!
Did I help you out? Feeling generous? I accept tips via Bitcoin @ 14mDxaob8Jgdg52scDbvf3uaeR61tB2yC7

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users