Htaccess to nginx


I have few rules in htaccess file, these help me to fix old url 404 error

RedirectMatch 301 ^/([0-9]{4})/([0-9]{2})/(?!page/)(.+)$$3
RedirectMatch 301 ^/blog/([0-9]{4})/([0-9]{2})/(?!page/)(.+)$$3

Now I’m moving to lemp server and I need to convert these rules for nginx server block but after searching a lot, I didn’t find the solution. Please help me to convert and fix 404 error.



To convert .htaccess rule to Nginx config

Try these sites

Still unable to do?
A) Try Redirection plugin with Regular Expression.
B) Guess, they offer export Nginx compiled rule also. Please check.



these sites didn’t work for these rules, I tried, but it has been solved now:

> rewrite "^/([0-9]{4})/([0-9]{2})/(?!page/)(.+)$"$3 permanent;
> rewrite "^/blog\/([0-9]{4})/([0-9]{2})/(?!page/)(.+)$"$3 permanent;


You can close the thread.
Thanks for help.


You’re welcome!

Keeping this topic open may help other to get/share answer on the this question. :thinking:


Okay, no problem. :grinning: