dhinged Posted February 17, 2013 Share Posted February 17, 2013 (edited) 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 February 17, 2013 by dhinged Quote Link to comment https://forums.phpfreaks.com/topic/274597-htaccess-versioning/ Share on other sites More sharing options...
salathe Posted February 17, 2013 Share Posted February 17, 2013 (edited) 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 February 17, 2013 by salathe Quote Link to comment https://forums.phpfreaks.com/topic/274597-htaccess-versioning/#findComment-1412975 Share on other sites More sharing options...
kicken Posted February 17, 2013 Share Posted February 17, 2013 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. Quote Link to comment https://forums.phpfreaks.com/topic/274597-htaccess-versioning/#findComment-1412993 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.