Frederic G. MARAND 7de98fa770 Fix namespace and folder name for tests discovery on DrupalCI. | 6 years ago | |
---|---|---|
src | 6 years ago | |
templates | 6 years ago | |
tests | 6 years ago | |
README.md | 6 years ago | |
url_replace_filter.info.yml | 6 years ago | |
url_replace_filter.install | 6 years ago | |
url_replace_filter.module | 6 years ago |
The URL Replace Filter module 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.
<a href="http://example.com:8080/somepath">Some link</a>
<a href="/somepath">Some link</a>
<img src="http://a.example.com/files/img.jpg" alt="Some image" />
<img src="/files/img.jpg" alt="Some image" />
You can setup such replacements in the URL Replace Filter settings as follow:
http://example.com:8080/
%baseurl/
http://dev.example.com/
%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).
Like any Drupal filter, the original user-entered content is not altered. The filter is only applied (and its result cached) when the node is viewed.
Enable the module
Go to the Configuration
> Content authoring
> Text formats and editors
page, and click configure next to the text format that shall replace URLs.
Enable the URL Replace Filter in the text format's configuration page, and save the configuration.
Click the URL Replace filter
vertical tab at the bottom of the page.
In the URL Replace Filter box, enter original and replacement URLs in the
appropriate fields and save the configuration. More empty replacement fields
will automatically be added after saving, in case you need more fields than
provided by default.