← All text tools

Htaccess to Nginx Rewrite Converter

Convert common .htaccess RewriteRule, RewriteCond, Redirect, access and header rules into nginx config, with every line it cannot translate listed.

  • Free
  • No sign-up
  • Works on any device

About Htaccess to Nginx Rewrite Converter

Apache reads rewrite and redirect rules from .htaccess files on every request, while nginx has them in its server config. This converter turns the common directives into nginx syntax: RewriteRule with flags such as L, R=301, NC, QSA and F, RewriteCond tests on host, scheme and files, Redirect and RedirectMatch, Require and Order/Allow/Deny, Header set, ErrorDocument and DirectoryIndex. Per-directory patterns lose their leading slash in Apache, so the tool adds it back. Lines with no safe translation stay as comments and are listed for you.

How to use Htaccess to Nginx Rewrite Converter

  1. Paste your .htaccess rules, or open the file, and say whether the patterns come from a .htaccess or from the server config.
  2. Read the nginx result and the list of lines that could not be converted.
  3. Paste the output inside your server block, run nginx -t to test it, and then reload nginx.

Why use this tool?

Also known as

Frequently asked questions

Why does the nginx pattern start with a slash?

In a .htaccess file Apache matches paths without the leading slash, but nginx rewrite matches the full URI such as /old-page.html. The converter inserts the slash so the rule still matches.

Is every directive converted?

No. Only the common ones are. Things like AddHandler, php_value, Expires rules and password files need a manual setup, and they appear in the not-converted list.

Can I rely on the output without testing?

No. The two servers differ in edge cases such as rule order, query strings and regex flavours, so always run nginx -t and test your key URLs.

Is Htaccess to Nginx Rewrite Converter free?

Yes. Htaccess to Nginx Rewrite Converter on Toolipedia is free to use, with no sign-up and no watermark.

Is it safe to use?

Yes. Everything is worked out in your browser, and nothing you enter is sent to our server.

Does it work on my phone?

Yes. It works in any modern browser on Android and iPhone, as well as on tablets and computers. There's nothing to install.

Do I need an account?

No. Just open the page and use the tool. There's no sign-up and no email needed.