Search
Other ReReplacer questions
Forum

Unable to replace some hrefs

Mark's Avatar Mark
Hello

I'm trying to replace a url in an href.

Something like this:
E.g. <a href='/old/path'>Link Text</a>
SEARCH: /old/path
REPLACE: /new/path

I can see that for some urls on my page this has worked (e.g. I can change menu hrefs). Yet, for others hrefs.. they cannot be replaced.

FYI the unchanging urls are generated by another component (Joom donation eventbooking). Experimentation shows that I can use ReReplacer to change other eventbooking content (such as the URL Link Text) but not the destination of the href.

- I have enabled 'Enable in HTML tags', but still does not work

Kind regards
Mark
Peter van Westen's Avatar Peter van Westen ADMIN
URLs are changed by the Joomla SEF plugin and internals. So at the moment ReReplacer gets to see the URLS they might still be different.
Try changing the ordering of the plugins in question.
See: regularlabs.com/blog/242-plugin-order-is-important
Also, set the replacement's Search Area to Everywhere, to make sure it gets done as late as possible.
Please post a rating at the Joomla! Extensions Directory
Mark's Avatar Mark
Hi Peter

That worked - I moved the SEF plugin to the top. A quick test shows I can now change hrefs, and rest of the site is fine.

Thanks for your quick response!

Kind regards
Mark
Mark's Avatar Mark
Oh no, one more issue has appeared..

So I can now replace all hrefs, but I can only replace parts of the href that do not contain an ampersand character (&)

Works:
SEARCH: /path/page?param1=1

Not working:
SEARCH: /path/page?param1=1&param2=2

Various tests show that the '&' is a problem here.. any ideas?

Kind regards
Mark
Mark's Avatar Mark
Please ignore! I realised I should be matching on '&amp;'

All good now 🙂
Peter van Westen's Avatar Peter van Westen ADMIN
You can of course also tell ReReplacer to search for both.
Either via a list replacement:
/path/page?param1=1&param2=2,/path/page?param1=1&amp;param2=2
Or via Regular Expressions:
/path/page\?param1=1&(amp;)?param2=2
Please post a rating at the Joomla! Extensions Directory
You can only post on the extension support forum if you have an active subscription and you log in

Buy a Pro subscription