Drupal 7 Q & A .htaccess problem

David G - DrupalOn a recent Drupal Stack Exchange question a user said that many times designers have problems when moving a site from development to a production server due to issues with the .htaccess file. And, that these 2 lines in the default Drupal .htaccess file cause problems:

# Don't show directory listings for URLs which map to a directory.
Options -Indexes

# Follow symbolic links in this directory.
Options +FollowSymLinks

And that these 2 lines should be removed typically, and he what the common solutions are for this problem and how to secure the website if these lines are removed.

My Solution and Explanation of this Issue

I have actually seen this issue before myself when moving a project from my development system to hosting providers provided by my campus institution. My laptop has very liberal server configurations, I don’t worry much about my local laptop security due to strict network security and running a local firewall. But, the remote server administrators may limit what Apache Overrides may be available on Production systems. So my reply to this issue was:

This is a known issue, see: https://www.drupal.org/node/1269780 regarding a long term resolution.

In general it looks like going forward +FollowSymLinks should be replaced with +SymLinksIfOwnerMatch, but refer to the issue queue item above for a definitive answer.

Typically per host, and definitely with Shared Hosting plans it’s up to your webhosts documentation as to what Apache Overrides are allowed by your (system) user account. There is a certain amount of trial and error is seeing if -Indexes for example is allowed by your hosted webserver configuration.

In step #8 of How To Update Drupal Core it is recommended you backup the .htaccess and robots.txt files of your Drupal site. This is because per webserver these files are highly likely to be modified to work for that system and domain name.

I hope this issue and succict informative note on the recommended resolution helps you to deploy your projects with more ease!

Looking for quality web hosting? Look no further than Arvixe Web Hosting!

Tags: , , | Posted under Drupal, Website Transfer | RSS 2.0

Author Spotlight

David Gurba

I am a web programmer currently employed at UCSB. I have been developing web applications professionally for 8+ years now. For the last 5 years I’ve been actively developing websites primarily in PHP using Drupal. I have experience using LAMP and developing data driven websites for clients in aviation, higher education and e-commerce. If you’d like to contact me I can be reached at david.gurba@arvixe.com

Leave a Reply

Your email address will not be published. Required fields are marked *