I have my Drupal installation in a subfolder but don't want to display the subfolder in the URL.
For example I want www.example.com/* to redirect to www.example.com/drupal/*
I've achieved this using this .htaccess.
RewriteEngine on RewriteCond %{HTTP_HOST} ^(www.)?example.com$ RewriteCond %{REQUEST_URI} !^/drupal/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /drupal/$1 RewriteCond %{HTTP_HOST} ^(www.)?example.com$ RewriteRule ^(/)?$ drupal/index.php [L]
How can I make Drupal generate www.example.com URLs rather than www.example.com/drupal?
Any help would be appreciated, thanks.
Go with a virtual host, if possible. It easily maps a URL to a subfolder. Should work the same on Windows, *nix, etc... An example would be something like:
<VirtualHost *:80> ServerName example.com ServerAlias www.example.com DocumentRoot C:/Apache2.2/htdocs/drupal RewriteEngine On RewriteOptions Inherit ErrorLog "logs/coastal_error.log" LogLevel warn CustomLog "logs/coastal_access.log" combined </VirtualHost>
Most of the time I only use Apache Rewrite for removing (or adding) the www and clean URLs.
- John
************************************************** John Callahan, Geospatial Application Developer Delaware Geological Survey, University of Delaware URL: http://www.dgs.udel.edu **************************************************
Emma Badger wrote:
I have my Drupal installation in a subfolder but don't want to display the subfolder in the URL.
For example I want www.example.com/* to redirect to www.example.com/drupal/*
I've achieved this using this .htaccess.
RewriteEngine on RewriteCond %{HTTP_HOST} ^(www.)?example.com$ RewriteCond %{REQUEST_URI} !^/drupal/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /drupal/$1 RewriteCond %{HTTP_HOST} ^(www.)?example.com$ RewriteRule ^(/)?$ drupal/index.php [L]
How can I make Drupal generate www.example.com URLs rather than www.example.com/drupal?
Any help would be appreciated, thanks.
[ Drupal support list | http://lists.drupal.org/ ]
Thanks for your reply.
On 2 Sep 2009, at 13:12, John Callahan wrote:
Go with a virtual host, if possible. It easily maps a URL to a subfolder. Should work the same on Windows, *nix, etc... An example would be something like:
<VirtualHost *:80> ServerName example.com ServerAlias www.example.com DocumentRoot C:/Apache2.2/htdocs/drupal RewriteEngine On RewriteOptions Inherit ErrorLog "logs/coastal_error.log" LogLevel warn CustomLog "logs/coastal_access.log" combined
</VirtualHost>
Most of the time I only use Apache Rewrite for removing (or adding) the www and clean URLs.
- John
John Callahan, Geospatial Application Developer Delaware Geological Survey, University of Delaware URL: http://www.dgs.udel.edu
Emma Badger wrote:
I have my Drupal installation in a subfolder but don't want to display the subfolder in the URL.
For example I want www.example.com/* to redirect to www.example.com/drupal/*
I've achieved this using this .htaccess.
RewriteEngine on RewriteCond %{HTTP_HOST} ^(www.)?example.com$ RewriteCond %{REQUEST_URI} !^/drupal/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /drupal/$1 RewriteCond %{HTTP_HOST} ^(www.)?example.com$ RewriteRule ^(/)?$ drupal/index.php [L]
How can I make Drupal generate www.example.com URLs rather than www.example.com/drupal?
Any help would be appreciated, thanks.
[ Drupal support list | http://lists.drupal.org/ ]
-- [ Drupal support list | http://lists.drupal.org/ ]