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.

Link to comment
https://forums.phpfreaks.com/topic/274597-htaccess-versioning/
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.

Link to comment
https://forums.phpfreaks.com/topic/274597-htaccess-versioning/#findComment-1412975
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
https://forums.phpfreaks.com/topic/274597-htaccess-versioning/#findComment-1412993
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.