I am looking for a regex for a .htaccess file where I can redirect one URL to another.
URL1: / Dir / en-article-Title- 222
URL2: / DIR / 222 / en-article-header
I would like to redirect URL1 to 301 URL2.
In a high level language, I think I want to say .htaccess:
- Take the numbers after the last dash (-)
- Place these numbers in front of the article name with a trailing slash, i.e. 222 /
- Remove last dash and numbers from article title
Any thoughts, suggestions, code are welcome!
source share