I have an old website, which has been transfered to a wordpress install, with a lot of pages being numbered (That tells you the age of the website) and I want to redirect them to the main home page for now to limit 404 errors.
Examples of page names:
https://example.com/news3068.html
https://example.com/news2464.html
https://example.com/news537.html
https://example.com/news953.html
https://example.com/news2362.html
Now I want to redirect anything /news{number}.html to domain.com
How do I do this with regex, I have SEO Redirection Installed as it’s able to do regex redirections as was advised to me, but I have no idea how to do this as I haven’t come across regex before.
Thank you in advance
2
Answers
I found the answer in the end
^/news[0-9]{3,4}.html
The Breakdown:-
^/news (starts with /news)
[0-9]{3,4} (Contains the numbers 0-9 for 3 to 4 digits.. Only)
.html (finishes with .html)
Hope this helps people in furture - Its working on a wordpress plugin SEO Redirection Free as a Regex Redirect
Use plugin Redirection By John Godley. Try to make this settings:
Source url: /news(.*).html
Target: https://example.com/
on group “redirections”
Please make sure that you have regex tick box checked, right to source url!