Drupal emptied .htaccess file after installation

r_honey - July 4, 2009 - 09:08

I just finished installation of Druapl on my production server. Drupal reported that the server did NOT support clean url feature.

When I was investigating into this issue, I was surprised to see that .htaccess file was empty. Although I really did not checked out whether that file existed before installation began, but what I did was to upload the zip file itself to the web server, and then extract it in the public_html folder using the cPanel's built-in file manager.

To be sure, I again extracted the same zip to a different folder, and .htaccess was there as it accompnies the installation.

So, is it normal for Drupal to empty out this important file after installation??

Also, to enable clean urls, I copied the following from the original .htaccess to the empty one:
# Various rewrite rules.

RewriteEngine on

# If your site can be accessed both with and without the 'www.' prefix, you
# can use one of the following settings to redirect users to your preferred
# URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option:
#
# To redirect all users to access the site WITH the 'www.' prefix,
# (http://example.com/... will be redirected to http://www.example.com/...)
# adapt and uncomment the following:
# RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
# RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
#
# To redirect all users to access the site WITHOUT the 'www.' prefix,
# (http://www.example.com/... will be redirected to http://example.com/...)
# uncomment and adapt the following:
# RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
# RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]

# Modify the RewriteBase if you are using Drupal in a subdirectory or in a
# VirtualDocumentRoot and the rewrite rules are not working properly.
# For example if your site is at http://example.com/drupal uncomment and
# modify the following line:
# RewriteBase /drupal
#
# If your site is running in a VirtualDocumentRoot at http://example.com/,
# uncomment the following line:
# RewriteBase /

# Rewrite URLs of the form 'x' to the form 'index.php?q=x'.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

And clean urls work now. Is it advisable to restore the entire .htaccess to what accompanies the downloaded zip file??

Drupal does not modify the

ScoutBaker - July 7, 2009 - 06:04

Drupal does not modify the htaccess file. If yours is blank, and you didn't have any special settings, just use the one that shipped with Drupal. If you did have special settings, you can always add them to the copy that comes with Drupal as well.

---
"Nice to meet you Rose...run for your life." - The Doctor
My first public Drupal site - EyeOnThe503

 
 

Drupal is a registered trademark of Dries Buytaert.