1

I have recently removed a module from Magento that created vanity URL, for filtered searches. When I've removed this module its now using URL parameters for all filtered navigation pages.

I want to redirect all of these vanity urls to the same page without the vanity part of the URL.

An example of a URL that I want redirecting is:

/hand-dryers/high-speed/shopby/brand-jet_towel-ultradry-magnum_multi_dri-dyson/handdryer_dryingtime_seconds-under_10_seconds/

Redirecting to

/hand-dryers/high-speed

The way the module worked would be by adding the string "shopby" and then converting each parameter into a readable format.

I need a rewrite rule to re-direct all URLs that contain "shopby" to the same URL but with everything from "shopby" removed

I hope this makes sense. Look forward to hearing back from someone

2 Answers 2

1

Should work:

RewriteEngine on RewriteRule (/.*)/shopby $1 [R=302,L] 

After testing you can change the 302 to 301 to ensure the old URLs are pruned from search engine indexes.

Sign up to request clarification or add additional context in comments.

4 Comments

Thanks Niels Can you please explain the Rule?
Just a basic regular expression that catches all content before the literal /shopby part in a variable, ignores everything else, and then redirects to the caught block. This is rather basic knowledge, to understand it better I'd recommend reading some tutorials on rewriting.
Thanks Appriciate the help
Hit the checkmark next to the answer to mark it as 'accepted solution' if it helped you :)
0

Try this:

RewriteRule ^(.+?)/shopby/?.*$ $1/shopby [L] 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.