Link to home
Create AccountLog in
Avatar of Member_2_7966984
Member_2_7966984

asked on

Regular Expression needed to Alter URL on WPengine hosted website using Nginx

So we recently migrated a site over from Joomla to wordpress - we were able to get the permalinks to match very closely however the joomla URL throws a random number in fron of the post title in the URL - They are very concerned about getting the links to redirect properly on the new website - So was wondering if someone could help me with writing a redirect rule that would work on a Nginx server 


I found this post which seems similar to what I am trying to do - https://serverfault.com/questions/1100714/having-trouble-getting-a-regex-to-redirect-traffic-to-work-correctly 


just need it modified for my specific use case 


So here is an example scnario


 New site URL (Wpengine)  - https://shareplannestg.wpengine.com/blog/strategies-for-trading/5-steps-to-making-back-your-losses.html 


current site URL (Joomla)  https://www.shareplanner.com/blog/strategies-for-trading/24279-5-steps-to-making-back-your-losses.html


So I would need a 301 redirect rule that would remove the random numbers in front of the post name - in this example it would be 24279-  that would need to be removed to create a redirect that goes to https://shareplannestg.wpengine.com/blog/strategies-for-trading/5-steps-to-making-back-your-losses.html 



we were playing around with some stuff but it was breaking a lot of the image URLs because some of the images have numbers in them... So need a solution that will not change the URL if it is an image.


This is what we tried 
User generated image


ASKER CERTIFIED SOLUTION
Avatar of Terry Woods
Terry Woods
Flag of New Zealand image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account