Apache to Nginx Converter
Free online Apache to nginx converter. 100% client-side.
Loading tool...
What is Apache to Nginx Converter?
The Apache to Nginx Converter translates Apache mod_rewrite configuration β the RewriteRule, RewriteCond, Redirect, and ErrorDocument directives found in .htaccess files β into equivalent nginx configuration using location blocks, return redirects, proxy_pass blocks, and error_page directives. Conversion happens entirely in your browser.
Key Benefits
- Migrate from Apache to nginx without hand-translating every rewrite rule
- Keep 301/302 redirect status codes intact to preserve SEO rankings
- Catch unsupported directives instead of silently dropping them
- Audit every conversion in a rule-by-rule table before deploying
- Keep sensitive server config private β nothing is uploaded
Common Use Cases
- β’Moving a WordPress or PHP site from Apache shared hosting to an nginx VPS
- β’Porting legacy .htaccess redirect lists into a clean nginx site config
- β’Reviewing an inherited Apache config before a platform migration
- β’Learning how nginx location and return map to familiar mod_rewrite patterns
How to Convert Apache Rewrite Rules to Nginx
- Paste your Apache config: Copy the relevant RewriteRule and Redirect lines from .htaccess into the input, or press Load sample to see a typical conversion.
- Review converted and skipped counts: The summary shows how many directives were converted and how many were skipped β skipped lines appear as TODO comments and in the warnings list.
- Compare rule by rule: The rule-by-rule table pairs each Apache line with its nginx equivalent, such as return 301 for redirects or proxy_pass for [P] proxy rules.
- Wrap, copy, and test: Tick Wrap in a server block if you need a full context, press Copy or Download to save nginx-rewrite.conf, and run nginx -t before reloading.
Key Features
- RewriteRule to location + return conversion with R=301/R/L flag handling
- [P] proxy flag becomes a proxy_pass block with standard proxy headers
- Redirect / RedirectPermanent / RedirectTemp mapped to correct status codes
- RewriteCond HTTPS-off pattern becomes an if ($scheme) HTTPS redirect
- ErrorDocument translated to nginx error_page directives
- Rule-by-rule audit table plus manual-review warnings for unsupported lines
Frequently Asked Questions
Which Apache directives does it convert?
RewriteCond %{HTTPS} off, RewriteRule (including [P] proxy rules and the HTTP-to-HTTPS catch-all), Redirect, RedirectPermanent/Temp/Seeother, and ErrorDocument. Unknown directives are skipped and listed for manual review instead of being guessed.
What is the Wrap in a server block option for?
Nginx location and error_page directives must live inside a server context. Tick the box to indent the output inside a server { listen 80; server_name example.com; } skeleton ready to paste into a config file.
Why is the output different from Apache?
Nginx has no .htaccess and evaluates location blocks differently from mod_rewrite, so the converter produces the closest safe equivalent, like return 301 redirects, and marks anything that needs judgement in the warnings list.
How do I verify the conversion?
Compare the rule-by-rule table (Apache on the left, nginx on the right), review the skipped lines, download nginx-rewrite.conf, and test with nginx -t before reloading. Everything runs locally in your browser.