I want to redirect many URLs in my shop. Here is the example:
/pl/index/12 /pl/index/16 /pl/index/18
and so on.
What would be the rule for .htaccess to rewrite all of trash URLs from the previous version of shop to my main page?
Webmasters Stack Exchange is a question and answer site for pro webmasters. It only takes a minute to sign up.Sign up to join this community
As stated by Stephen, you should rather set a
410 Gone redirection, like this:
# /.htaccess: Redirect 410 /pl/index/12 Redirect 410 /pl/index/16 Redirect 410 /pl/index/18 # And so on.
Or, if you can identify a pattern in the paths that have to be redirected, you can use the
RedirectMatch directive, for example:
# /.htaccess: # Of course, you **must** adapt this regex to your case. RedirectMatch 410 ^/pl/index/1[2|6|8]$
If you can identify a pattern in your paths and want to "410-redirect" the users to a specific page explaining what happens with these gone pages, you can use
# /.htaccess: # Of course, you **must** adapt this regex to your case. RewriteRule ^pl/index/1[2|6|8]$ /special-error410-page.html [R=410,L]