I've got an odd situation here. I just installed Drupal 4.7.3 on my webhost (MySQL 4.0.27, PHP 4.4.2, Apache 1.3.34) in a directory off the document root called drupal. I've updated the htaccess files in both the doc root and drupal directories (see below) to redirect everything to /drupal then hide the /drupal in the url. The problem I'm seeing is when I load the default page (i.e. no path after the host) I get a "Page Not Found". All the menus work, you can log in and if you add index.php to the URL it loads fine. It's just the default page that gives a "Page Not Found".

I suspect it's something I've missed in the htaccess files but I can't figure out what.

If anyone want's to take a look it's at http://magpiearts.com.

Doc Root htaccess

# Default rules for magpiearts

# Set some options
Options -Indexes

# Set the default handler.
DirectoryIndex index.php

# Rewrite rules
RewriteEngine On
RewriteBase /

# First kill the www
RewriteCond %{HTTP_HOST} ^www.* [NC]
RewriteRule ^(.*)$ http://magpiearts.com/$1 [L,R]

# Redirect everything to the drupal directory
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /drupal/$1

/drupal htaccess rewrite rules (the rest is stock)

RewriteBase /drupal
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [QSA]
RewriteRule ^/drupal/(.*)$ $1 [L,PT]

Comments

WebWeasel’s picture

This was a tricky mod_rewrite issue. What was happening is that the root htaccess rules only worked for a URI other then the default. Soooo, when it tried to load "/" it got a 404 and that caused the error handler defined in drupal to fire and pull up drupal.

I made changes to the doc root rewrite rules (see below) and then changed the one in drupal back to stock. Now I don't need the passthrough rule in the drupal directory either and it still is hidden due to "$base_url = 'http://magpiearts.com'".

I hope this saves someone else some time. It cost me plenty but I'm working towards mod_rewrite guruhood.

Root htaccess rewrite rules

# Rewrite rules
RewriteEngine On
RewriteBase /

# First kill the www
RewriteCond %{HTTP_HOST} ^www.* [NC]
RewriteRule ^(.*)$ http://magpiearts.com/$1 [L,R]

# Redirect everything to the drupal directory

# The default URI needs special handling
RewriteCond %{REQUEST_URI} ^/$
RewriteRule .* drupal/

# This handles everything else
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ drupal/$1