I very much like to try Drupal but I wonder if I can install and use Drupal in a subdirectory other than the root directory of my website. Is this possible?

Your help is much appreciated.

Comments

darius’s picture

Easily, no problem at all.

Darius

ñull’s picture

You only have to change the $base_url in sites/default/settings.php

ljCharlie’s picture

Thank you so much! I'll give that a try tonight.

soup’s picture

i have the same setup - drupal in a sub-directory of the root. eg
http://www.mysite.com/drupal

question: is there a way where the browser will understand
http://www.mysite.com instead?

If so how do I can I go about it? thanks

DVV’s picture

if I understood correctly your question you want to type the address www.mysite.com and want this to point to www.mysite.com/drupal.

If this is the case than the solution is very simple (although outside drupal). Just put an index file in the root of www.mysite.com with a redirection to mysite.com/drupal

For instance write an "index.php" file with the following content:

$url = "drupal";
header('HTTP/1.1 301 Moved Permanently');
header('Location: '.$url);
exit;

you can skip the 'Moved Permanently' line but it is advisable for SEO purposes... ;-)

Hope this helped

soup’s picture

Thanks Gigi,

I was just going to google trying with URL rewrites (not that i know how to) until I saw your reply. Thats what I meant and it does redirection just fine.

But just to push this further along, is it possible to maintain the browser's URL display at www.mysite.com AFTER the redirection? It currently shows www.mysite.com/drupal, as would be expected, since thats where the page is.

ljCharlie’s picture

Okay, I finished the installation. Here's the error when I tried to create a page.

user error: Access denied for user: 'dbauser@localhost' to database 'drupal'
query: LOCK TABLES sequences WRITE in /home/mySite/public_html/drupal/includes/database.mysql.inc on line 66.

warning: Cannot modify header information - headers already sent by (output started at /home/mySite/public_html/drupal/includes/common.inc:384) in /home/mySite/public_html/drupal/includes/common.inc on line 192.

ljCharlie’s picture

I just found that the page, which is static, is display on the website but I don't understand why it gave me that error message.

GN’s picture

at the end of config.php file

ljCharlie’s picture

I do not see the config.php file in the drupal folder. I only see the settings.php file. And this file does not have extra space before or after.

DVV’s picture

what you want is probably what is called "url cloaking".

As far as I know you can do this only with frames (and maybe some voodoo apache server magic I'm not aware of).

briano-1’s picture

I know this solution was posted in 05, but it's still helpful.
I just ran into the same problem, and fixed it with a simple index.php as stated by GentleArsonist.
So, thanks.

here’s picture

I believe you are looking for is this open issue, including a php hack I've yet to test:

Core Drupal in its own directory, configuration, modules and themes in custom
http://drupal.org/node/22336

good luck.

Success’s picture

Thanks, that's a useful link.

Success’s picture

Seem like there's no update for that.

kusik’s picture

This is an old thread but still relevant and helpful. I found this link useful.