Looking for a regex to redirect (remap) old URL to the WordPress site efficiently.
The goal is to redirect all the old URL to a new set of URLs without losing the pagerank ( 301 redirect )
/file/Abc_123_ABC_Abc.shtml to be /abc-123-abc-abc
Objectives:
1.remove /file/
2.convert to lowercase
3.replace all _ with – (appears about 2 to 4 times in a URL)
4.remove the extension (both .htm & .shtml)
How to achive the point 3 in htaccess redirect?
Almost identical use-case (the only difference is the lowercase and the folder name):
HTACCESS : RegEx match replace for URL
Best I’m aware, you cannot lowercase using a rewrite rule, so you’ll need to rewrite to a redirect handler, and process it from there: