I wanted to install Drupal in a subdirectory, for instance ~/public_html/drupal, and still access it as root.

The theory is simple: put Drupal in a subdirectory then add a .htaccess file in the root directory that redirects non existing URL's to '/drupal'. But in practice it proves to be more tricky than I thought.

So, here is the code for the .htaccess file:

Options -Indexes
Options +FollowSymLinks
 
<IfModule mod_rewrite.c>
RewriteEngine On
 
# skip processing the drupal files
RewriteCond %{DOCUMENT_ROOT}/drupal%{REQUEST_URI} -f
RewriteRule .* drupal/$0 [L]
 
# process drupal urls 
RewriteCond %{HTTP_HOST} ^kenjiru\.ro|www\.kenjiru\.ro$ [NC]
RewriteRule ^$ drupal/ [L]
 
# the actual redirect
RewriteCond %{HTTP_HOST} ^kenjiru\.ro|www\.kenjiru\.ro$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ drupal/$1 [L]
</IfModule>

I specified the domain because I'm having other addon domains hosted on the same document root.

User login

Who's online

There are currently 0 users and 0 guests online.