If I have an installation in a subdirectory, then the subdirectory gets added on twice when the URL is rewritten. So, a URL like "/subdir/node/1" would get rewritten to be "http://example.com/subdir/subdir/node/1".

I think the $base_path needs to searched for, instead of "/", and the following code should do it:

global $base_path;
$text = preg_replace(
  '/(src|href)=(\'|")' . preg_quote($base_path, '/') . '/',
  '$1=$2'. url('<front>', array('absolute' => TRUE, 'language' => $lang)),
  $text
);

Comments

oskar_calvo’s picture

Category: bug » feature

@joelstein

I have the same problem, and your code solved it.

You should make a patch to the module.

Oskar

joelstein’s picture

StatusFileSize
new513 bytes

Here's the patch.

podarok’s picture

Version: 6.x-1.1 » 7.x-1.x-dev
Assigned: Unassigned » podarok
Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.