If I was to have my site in the web root, for example /var/www/ but the path to my site is http://example.com/drupal, how do I configure the base path etc.

If I set my base path to http://example.com/drupal it doesn't seem to work unless the site is also in a subdirectory (ie. /var/www/drupal/).

I know I can easily just move the site to /var/www/drupal/, but I'm curious to know if it is possible to do it at /var/www/ with just drupal config.


1 Answer 1


It it impossible, unless you count .htaccess (or similar config file for your webserver) as Drupal config too. If you do, in Drupal UI change base URL to http://example.com/drupal and use mod_rewrite to remove "drupal" from URI before further processing.

Note that this will not disable direct access. Of course you can block any calls without "drupal" prefix, but it would mean nothing except Drupal can work there. So if your goal is anything more than marking it's Drupal in your URLs, it's not a way to go.

Note: your mileage may vary depending on web server used.

  • I kindly ask anyone more fluent with mod_revrite to provide code samples. I know it can be done 'cause I did something similar, but can't reliably provide source codes.
    – Mołot
    Jun 18, 2013 at 7:44
  • That's what I thought. It's good to have confirmation, thanks.
    – rooby
    Jun 18, 2013 at 10:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.