I'm moving a constructed Drupal site form a development environment to a live server. The client has bought the "Linux Developer" package with Fasthosts.
If I move the .htaccess that was working fine on our dev server to the live server the whole site breaks, with an Internal Server Error message. Nothing in the error log thats any use.
I've checked with phpinfo() and apache is loading mod_rewrite.
While I'm waiting for the client to send the tech support info, I just wondered if anyone might have had a similar experience? I've searched and most info relevant to this issue seems to be packages with no mod_rewrite or very limited functions enabled for htaccess. However I've had no success so far trimming out optional bits in the htaccess file.
TIA
R
Comments
My guess is that it is the
My guess is that it is the final mod_rewrite rule in .htaccess that is causing the problem, and conflicting with some other Apache rewrite rules or other settings/parameters.
Are clean URLs turned on?
Do any of these URLs work:
yoursite.com/?q=node
yoursite.com/index.php
yoursite.com/index.php?q=node
gpk
----
www.alexoria.co.uk
Some success
Yes, this format worked when clean urls was on - i used it to get access to admin and switch them off: yoursite.com/?q=node
By the final rule do you mean this line?
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]And the 2 lines above it,
And the 2 lines above it, which are part of the same rule.
Do any of those URLs work now?
gpk
----
www.alexoria.co.uk
Solved
fasthosts pretty much only allow rewrite rules in their htaccess. I had to remove everything except the URL rules. My htaccess is below in case anyone else has same problem:
<IfModule mod_rewrite.c>
RewriteEngine on
# If your site can be accessed both with and without the prefix www.
# you can use one of the following settings to force user to use only one option:
#
# If you want the site to be accessed WITH the www. only, adapt and uncomment the following:
# RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC]
# RewriteRule .* http://www.example.com/ [L,R=301]
#
# If you want the site to be accessed only WITHOUT the www. , adapt and uncomment the following:
# RewriteCond %{HTTP_HOST} !^example\.com$ [NC]
# RewriteRule .* http://example.com/ [L,R=301]
# Modify the RewriteBase if you are using Drupal in a subdirectory and
# the rewrite rules are not working properly.
RewriteBase /
# Rewrite old-style URLs of the form 'node.php?id=x'.
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{QUERY_STRING} ^id=([^&]+)$
#RewriteRule node.php index.php?q=node/view/%1 [L]
# Rewrite old-style URLs of the form 'module.php?mod=x'.
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{QUERY_STRING} ^mod=([^&]+)$
#RewriteRule module.php index.php?q=%1 [L]
# Rewrite rules for static page caching provided by the Boost module
# BOOST START
<IfModule mod_mime.c>
AddCharset utf-8 .html
</IfModule>
RewriteCond %{REQUEST_URI} !^/cache
RewriteCond %{REQUEST_URI} !^/user/login
RewriteCond %{REQUEST_URI} !^/admin
RewriteCond %{HTTP_COOKIE} !DRUPAL_UID
RewriteCond %{REQUEST_METHOD} ^GET$
RewriteCond %{QUERY_STRING} ^$
RewriteCond %{DOCUMENT_ROOT}/cache/%{SERVER_NAME}/0/%{REQUEST_URI} -d
RewriteCond %{DOCUMENT_ROOT}/cache/%{SERVER_NAME}/0/%{REQUEST_URI}/index.html -f
RewriteRule ^(.*)$ cache/%{SERVER_NAME}/0/$1/index.html [L]
RewriteCond %{REQUEST_URI} !^/cache
RewriteCond %{REQUEST_URI} !^/user/login
RewriteCond %{REQUEST_URI} !^/admin
RewriteCond %{HTTP_COOKIE} !DRUPAL_UID
RewriteCond %{REQUEST_METHOD} ^GET$
RewriteCond %{QUERY_STRING} ^$
RewriteCond %{DOCUMENT_ROOT}/cache/%{SERVER_NAME}/0/%{REQUEST_URI}.html -f
RewriteRule ^(.*)$ cache/%{SERVER_NAME}/0/$1.html [L]
# BOOST END
# Rewrite current-style URLs of the form 'index.php?q=x'.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</IfModule>
Thanks for the replies though GPK :-)
OK glad you got to the
OK glad you got to the bottom of it. Will be of use to other Fasthosts users I'm sure.
gpk
----
www.alexoria.co.uk
It just was...
Thanks for the tip - I'd realised that fasthosts barfed on most of the .htaccess, so had it all turned off, but have now got clean URLs working nicely.
Cheers.
htaccess mod_rewrite
This worked!!! -thanks -you save me loads of time trying to sort this one!
Bluesmoke
Big help
This sorted my problems with my site that I'd uploaded to my host Net Explorers.
Thanks so much
Support for families with children with medical conditions: http://www.parentsown.co.uk
security
Won't that mean that people can access directories such as http://www.yoursite.com/themes ?
What
makes you say that? I really have no clue when it comes to these things but I'd be interested to understand what it is in that code that makes you think it will allow access to certain directories (just for my own understanding).
Thanks
Support for families with children with medical conditions: http://www.parentsown.co.uk
Fixed mine too
Hi. I had raised a support call with fasthosts and their reply was to ask if they could reset my ftp password and 'demostrate' that rewrites were working. Since they offered no more information than that I declined and asked for them to phone me. They can't dial outside lines though so I said I would come look here.
I'm glad I did. Two minutes later and my site is running with clean urls. Thanks :)
Thanks!
Thanks so much for this solution! Worked immediately and saved me hours of frustration...
Pauline Moon
Herts Premium Websites
Drupal 6.10 on fasthost .htaccess
this cut down version of the default .htaccess file worked for me on a Fasthosts:
#
# Apache/PHP/Drupal settings:
#
# Make Drupal handle any 404 errors.
ErrorDocument 404 /index.php
# Force simple error message for requests for non-existent favicon.ico.
<Files favicon.ico>
# There is no end quote below, for compatibility with Apache 1.3.
ErrorDocument 404 "The requested file favicon.ico was not found.
</Files>
# Override PHP settings. More in sites/default/settings.php
# but the following cannot be changed at runtime.
# PHP 4, Apache 1.
<IfModule mod_php4.c>
php_value magic_quotes_gpc 0
php_value register_globals 0
php_value session.auto_start 0
php_value mbstring.http_input pass
php_value mbstring.http_output pass
php_value mbstring.encoding_translation 0
</IfModule>
# PHP 4, Apache 2.
<IfModule sapi_apache2.c>
php_value magic_quotes_gpc 0
php_value register_globals 0
php_value session.auto_start 0
php_value mbstring.http_input pass
php_value mbstring.http_output pass
php_value mbstring.encoding_translation 0
</IfModule>
# PHP 5, Apache 1 and 2.
<IfModule mod_php5.c>
php_value magic_quotes_gpc 0
php_value register_globals 0
php_value session.auto_start 0
php_value mbstring.http_input pass
php_value mbstring.http_output pass
php_value mbstring.encoding_translation 0
</IfModule>
# Various rewrite rules.
<IfModule mod_rewrite.c>
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]
</IfModule>
# $Id: .htaccess,v 1.90.2.3 2008/12/10 20:04:08 goba Exp $
can anyone see any potential problems in loosing some of the config in the default .htaccess?
tried this?
http://drupal.org/node/31725#comment-79506