0
votes

I have about 3500 pages that will change URL because I need to remove one keyword from the URL. I will submit an updated sitemap to google but I would also like to provide htaccess 301 redirects for a while.

old url example "http://www.domain.com/my-old-url/" new url is "http://www.domain.com/my-url/"

old url example "http://www.domain.com/my-old-url-page/" new url is "http://www.domain.com/my-url-page/"

Keyword that needs to be removed is "old" and repeats itself across all url's.

Having 3500 individual 301 redirect lines in my htaccess would probably slow down my server and I don't think it's wise to do.

So I am asking what would be the best way to apply these 3500 redirects? Please provide code examples for your suggestions.

Thank you.

1
Provide some examples of old and new URLs - anubhava
@anubhava examples added, thanks! - Florin C.
That’s an easy thing to do with a RewriteRule. Do some research on that, try some things – and then report back with your results. - CBroe

1 Answers

1
votes

You can just use a RedirectMatch rule here in your root .htaccess:

RedirectMatch 301 ^(.+?)-old(.*)$ /$1$2