File paths when moving a subsite from a subdomain to a subdirectory

Events happening in the community are now at Drupal community events on www.drupal.org.
samcohen's picture

Up until now I've always placed subsites in subdomains and this has worked well. But a client now wants to move all subsites from the subdomains to subdirectories -- not just aliases, but actually have the sites live there.

Now, I've seen directions for making this work via symlinking, but I was wondering what this will mean for existing content with relative file paths.

For example, a current subsite at sub.domain.com has tons of images that show a path similar to /files/images/pic.jpg . If I move the entire subsite to domain.com/sub the same images will now live at /sub/files/images/pic.jpg . My question, is there a way to make the subsite think that the root is here /sub/ and not here / so that all the relative paths will still work?

Thank You,
sam

Comments

From beyond the horizon,

Garrett Albright's picture

From beyond the horizon, riding on a dark horse, Pathologic appears in the nick of time and slays the Broken Path demons.

Thanks. It's great to know

samcohen's picture

Thanks. It's great to know about this (is the path broken in your link on purpose?) and I may go this way -- however, I can see potential problems -- for example, if it's an input filter what happens, say, when you are uploading photos with TinyMCE -- and you want to preview them in your rich text editor -- the input filter would display them correctly, but that wouldn't help in the editor view.

I do still wonder if there's a server trick that would treat a subdirectory like a root directory, so that all relative paths start at the subdirectory level, not at the root?

Sam

NMS: Drupal Training & Services
www.new-media-solutions.com/drupal-training

Greater Philadelphia Drupal Meetup
www.meetup.com/drupaldelphia

is the path broken in your

Garrett Albright's picture

is the path broken in your link on purpose?

Broken link? Golly, whatever may you be speaking about? (coff)

what happens, say, when you are uploading photos with TinyMCE -- and you want to preview them in your rich text editor -- the input filter would display them correctly, but that wouldn't help in the editor view.

If you are uploading new photos for the first time, then they will be placed at the new, correct path anyway. If you're trying to look at or edit a previously-existing node with "broken" paths in TinyMCE, then, yes, there will be problems, but that's not something Pathologic was really designed to fix. I guess while you're editing the node anyway, you might as well go ahead and fix the paths manually so your pictures will show up in TinyMCE again.

But, of course, the best solution is not to use WYSIWYG crutches like TinyMCE… but I bet you're sick of hearing that, or have n00b clients, or whatever.

I do still wonder if there's a server trick that would treat a subdirectory like a root directory, so that all relative paths start at the subdirectory level, not at the root?

The "RewriteBase" directive in Drupal's .htaccess file may be what you're speaking of. But I don't think tweaking that is going to fix old paths without breaking new ones or vice versa.

Multisite

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: