Those days I am moving my website from Apache2.4 to Nginx.
So I googled for “convert apache rewrite to nginx”. I found the folllowing articles:
- Converting Apache Rewrite Rules to NGINX Rewrite Rules
Read it. - Converting rewrite rules
Shorter but complements the above article. Read it, too. - How to Convert htaccess Rewrite Rules to Nginx Rewrite Directives
If you prefer this style of writing, read it in lieu of the above articles. - Convert .htaccess to Nginx Directives
Read it if you need to see yet another example of conversion from Apache2.4 into Nginx. - Convert Apache configuration to Nginx [closed]
Has references to SaaS websites for converting from Apache2.4 into Nginx (see below). - Nginx – Convert apache rewrite rules to nginx
Mentions Apache2.2 and PHP-5, so the relevant information may be obsolete. Skip it. - rewrite rules from apache to nginx
One cannot be sure if the answer is correct – skip it. - How To Enable mod_rewrite In Nginx
Waste of your time – skip it.
In addition to the aforementioned articles, I found the following SaaS services for converting Apache2.4 configuration files into Nginx configuration files.
- https://winginx.com/en/htaccess
htaccess to nginx converter. Does good job. - https://htaccess2nginx.toolpie.com/
Htaccess to nginx Apache rewrite rule convert to nginx.
This website actually uses winginx.com to perform the conversion. At bottom of the page, you’ll find that it links to several SaaS conversion services, one of which is the above winginx.com service. - https://www.getpagespeed.com/apache-to-nginx
Apache .htaccess to NGINX converter. Does good job and warns when some rule cannot be converted. - https://labs.gidix.de/nginx/
nginx-Apache-Rewrite-Converter. Was buggy when I tried it. However, it claims to be in beta. Caveat emptor.
I recommend that you run your conversion in both winginx.com and getpagespeed.com, review and edit the resulting Nginx configuration file.