Syndicate

Syndicate content




Move Drupal to sub-directory

04 Apr 2009
Posted by ninelouis

One of my production site have just been installed Drupal in the root directory, i.e. visitor browse to www.mysite.com will be brought to Drupal main page. Anyway, our Drupal configuration and contents are not ready yet, so we decide to pull it back - create other few pages as temporary, visitor will see this instead when browse to www.mysite.com. And then, move all Drupal files to new sub-directory, called "drupal", that we can access by pointing to www.mysite.com/drupal. This will let us have a test environment - on a live server, and continue development work at background.

Some problems we have found, solved are noted here,

Problem

  • except Drupal main page which is now at www.mysite.com/drupal, others pages return error 404 - page not found

Solution - 2 things you need to do

  • update variable $base_url
    in sites/default/settings.php to the sub directory Drupal is in, .e.g. for this case
    $base_url = 'http://www.mysite.com/drupal';
    This changes the links that Drupal generates so they point to the correct location.
  • move .htaccess also
    you need a copy of old .htaccess file you were using, which is in root director. Just copy it to the sub directory Drupal is moved to

Thanks to these sources, read more