0

Possible stupid question but worth a punt...

My local OS X setup uses Acquia Dev Desktop. I recently changed a remote site's .htaccess file to redirect all no www. URLs to their www. equivalents (done my uncommenting the relevant 2 lines already in Drupal 7 core .htaccess). Pulling this change down to my local setup now means that my local dev version can no longer be navigated to.

Running cron and clearing all caches via Drush doesn't seem to help in any way.

Do I have to use a different .htaccess file for local and remote setups or am I missing something here?

2

Yes, when you made a change to the remote .htaccess file, you made a system specific change that doesn't always apply if you copy the file elsewhere.

An option is to keep .htaccess stock (ie, the same as the version that came with Drupal) and do your site-specific configuration in an Apache configuration file. This way, when you transfer files, update core, drush pm-update, etc, you don't have to worry about local changes to .htaccess.

On a high volume site, it can make sense to ditch the .htaccess and move everything to an Apache configuration file. When the directives are in a config file, they get parsed/saved when Apache starts. When you use .htaccess, it gets parsed each and every request and not saved. Apache will also traverse the directory tree looking for an .htaccess.

| improve this answer | |
2

Yes, you need to use a separate .htaccess file for your local version of the site.

It often makes sense to sync just the sites/all and/or sites/default folders (minus settings.php of course) of a Drupal site, so you can avoid this sort of problem without even having to think about it; unless you're hacking at core of course, which isn't recommended anyway :)

| improve this answer | |
  • Thanks for the response. Even setting up a different .htaccess file wasn't enough on it's own. In the end I had to re-import the site in Dev Dektop as well to get it to spring back to life. I guess it's a Dev Desktop thing. Might switch to MAMP. – danbohea May 4 '12 at 11:51
  • BTW, I wasn't hacking at core but do try to keep my core files as part of my Git repo. I ended up adding .htaccess to my .git ignore file and untracking it. – danbohea May 4 '12 at 11:53
  • @DixHuit Good solution. I used to do exactly the same thing until I read Letharion's answer to this question...now I do that :) – Clive May 4 '12 at 11:56
  • Looks good. Will consider that in future. – danbohea May 11 '12 at 11:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.