1

Okay, so I've searched everywhere and while I can find plenty of stuff about moving a Drupal install out of a subdirectory I can't find anything on moving one into a subdirectory. I've recently taken over this project and it was developed without me so I've been landed in it here.

The problem is that the site was developed in the root of a dev server and I now have someone who wants it in a subdir. I've changed the base url in the htaccess and I've tried manually changing references in the CSS and DB but I can't be sure I've caught everything (modules etc).

What I want to know is, is there a way to force every link relative to the root to be relative to root/example instead. Basically everything that was once at www.example.com is now at www.example.com/subdirectory.

Thanks.

1 Answers1

0

There's two pieces to this. The first you've already done: configuring htaccess to set a base url that includes the subdirectory.

Unfortunately, you may have quite a few references in the node content (especially embedded images) that will stop working.

A relatively simple solution to this would be to include a <base href="foo.com/dir" /> tag in your site theme, but this isn't a great fix in the long term.

You can try modifying your database directly, through queries such as the following (use with care, backup your database ahead of time, etc):

UPDATE field_revision_body SET body_value = REPLACE(body_value, 'devdomain.com', 'proddomain.com/subdir') (add http:// into those queries)

You may also need to update the paths in your files table to reflect the new locations on disk, especially if you're using multisite.

Alternately, have you considered using the Backup & Migrate module to move content from the dev server to a new install at the new instance?