Ok, I've got a Drupal install with a lot of links inside various nodes. All of these links are relative.

The problem is that if they're going to say, an image or a pdf in the /sites/default/files directory, they stop working.

Let me give an example:

There is a link in a node like this:


www.livesite.com/sites/default/files/image1.png works

www.domain.com/devsite/sites/default/files/image1.png does not work

How do I (easily) switch the links to work in such a way? Do I have to do an .htaccess edit, or is there something in the Drupal settings for this? This is for Drupal 7


1 Answer 1


You can use the module Pathologic that acts as a filter on your text formats (Full HTML, Filtered HTML) and basically rewrites URL's which are parts of fields depending the site configuration and Pathologic settings.

You can for example set Processed URL format to Path relative to server root (/foo/bar) and for the All base paths for this site, you fill in the different website URL's.

Your Answer

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

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