Removing attributes from a URL address

You can use regular expressions to easily remove attributes from product URLs if you don’t want them there.

Problem:

…attributes remain in product URLs and I want to delete/shorten them. Example URL:
https://www.mujsupereshop.cz/produkt/damske-tricko-friends/?attribute_pa_color=seda&attribute_pa_6f6cb72d544962fa333e2e=xxl
And the final URL should look like this:
https://www.mujsupereshop.cz/produkt/damske-tricko-friends/

Solution:

In Mergado, all you need is one Find and Replace rule with the “regular expression” checkbox selected. Enter the regular expression \?.*$ in the Find field and leave the Replace field blank to remove the text.

The regular expression captures text starting with a question mark \? to the end of the URL address .*$.

Note: In this case, the question mark must be preceded by a backslash so that it is interpreted as a “normal” question mark, otherwise it is a regular expression character.

In the same way, it is possible to remove UTM parameters and other parameters from the URL address if they appear after the question mark.

Example of a rule in Mergado:

Tip: Don’t forget to check the box in the rule that you want to search as a “Regular expression”. :wink:

Example of what a regular expression matches: