Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

URL Replace Filter

Security covered Maintenance fixes only 288 sites

This module allows administrators to automatically replace absolute URLs in links and image sources with relative URLs. This is useful when moving a site between different domains or when the site is accessed via a proxy. You can configure which URLs to replace using a base URL token.

Allows administrators to replace the base URL in <img> and <a> elements.

Users tend to create links and images in their content with absolute URLs. This can be a problem if the site moves to another domain (perhaps between development and production sites) or is behind a proxy, with a different address for authenticated users.

Some replacement examples:

Before: <a href="http://example.com:8080/somepath>Some link</a>
After: <a href="https://www.drupal.org/somepath>Some link</a>

Before: <img src="http://dev.example.com/files/image.jpg" alt="Some image" />
After: <img src="/files/image.jpg" alt="Some image" />

You can setup such replacements in the URL Replace Filter settings as follow:

Original: http://example.com:8080/
Replacement: %baseurl/

Original: http://dev.example.com/
Replacement: %baseurl/

%baseurl is a token for your site's base URL. The above examples assume a site located in the domain's root directory (in which case %baseurl is actually empty).

Drupal versions

The module is available for Drupal 10, 9, 8, 6, 5, and 4.7. In most cases, Drupal 7 has better alternatives.

See also

Drupal 10–11 PHP 8.2

Ask your assistant about URL Replace Filter

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

Depends on

Dependencies of the latest stable release

  • filter Drupal core

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
3
Tracked since
Jul 2023
Latest release
2 years ago
Releases (12 mo)
0
Maintenance
Dormant

Release Timeline

Releases

Version Type Core PHP Release date
8.x-1.2 Stable 10–11 PHP 8.2 Jun 17, 2024
5.x-1.x-dev Dev Jul 14, 2023
8.x-1.1 Stable 9–10 Jul 14, 2023