Apache to Nginx Rewrite
Translate Apache RewriteRule and Redirect directives to nginx in your browser. Rules it cannot translate are listed for manual review, not guessed.
What this apache to nginx rewrite does
Each RewriteRule is translated only when its flags are R=301, R=302 or L; anything else, and every RewriteCond, is listed under "Not translated" with the reason. A rewrite that quietly changes behaviour is worse than one that asks for a human, so the page never invents an nginx equivalent for a construct it does not model.
How to use it
Apache to Nginx Rewrite: paste the .htaccess rules into the box above, and press Run to get the nginx directives below.
Worked example
Input:
RewriteEngine On
RewriteRule ^/old$ /new [R=301,L]
Redirect 302 /tmp /new
Output:
# Translated
# RewriteEngine On — nginx has no equivalent switch; rewrites below are always on
rewrite ^/old$ /new permanent;
rewrite ^/tmp$ /new redirect;
Why it runs in your browser
The conversion happens on this page with JavaScript. Your input is not posted to a server, so it works offline after the page loads and nothing is retained anywhere. The page reads .htaccess rules and returns nginx directives; reloading the page discards both.
Each RewriteRule is translated only when its flags are R=301, R=302 or L; anything else, and every RewriteCond, is listed under "Not translated" with the reason. A rewrite that quietly changes behaviour is worse than one that asks for a human, so the page never invents an nginx equivalent for a construct it does not model.
Translate Apache RewriteRule and Redirect directives to nginx in your browser. Rules it cannot translate are listed for manual review, not guessed.
How to use it
Apache to Nginx Rewrite: paste the .htaccess rules into the box above, and press Run to get the nginx directives below.
Why it runs in your browser
The conversion happens on this page with JavaScript. Your input is not posted to a server, so it works offline after the page loads and nothing is retained anywhere. The page reads .htaccess rules and returns nginx directives; reloading the page discards both.
What to Expect
Best for
- Converting .htaccess rules to nginx directives when the data is already on screen.
What this tool keeps
- Your input is not posted to a server, so it works offline after the page loads and nothing is retained anywhere.
Sample input
RewriteEngine On RewriteRule ^/old$ /new [R=301,L] Redirect 302 /tmp /new
Sample output
# Translated # RewriteEngine On — nginx has no equivalent switch; rewrites below are always on rewrite ^/old$ /new permanent; rewrite ^/tmp$ /new redirect;
Frequently asked questions
How do I use the apache to nginx rewrite?
Apache to Nginx Rewrite: paste the .htaccess rules into the box above, and press Run to get the nginx directives below.
Is my input uploaded?
No. The text is parsed on this page with JavaScript and is never posted to a server.
Is there a size limit?
Yes: 5 MB per run. Larger input is refused with a message rather than freezing the tab.
Build custom tools for your store
Join the SDK program to create useful ecommerce utilities for your store.