Skip to content
100% local

htaccess to Nginx converter

Convert Apache .htaccess rules into an equivalent Nginx configuration.

Input
Output

htaccess to Nginx converter

Paste the contents of an Apache .htaccess file and this tool rewrites the rules into the closest equivalent Nginx configuration. It is built for developers moving a site from Apache to Nginx (or setting up a matching Nginx config for local development) who don't want to hand-translate every RewriteRule and RewriteCond line by line.

The options let you turn each rule family on or off independently. RewriteRule and RewriteCond become rewrite directives with an if block for the (single) preceding condition, matching common flags like R=301, L, NC, F and G. Redirect and RedirectMatch become location blocks that return the right status code. ErrorDocument becomes error_page, Header directives become add_header, and ExpiresDefault/ExpiresByType become expires directives on a matching file-extension location. Access control (Order, Deny/Allow, Require) becomes allow/deny, and a complete AuthType Basic block becomes auth_basic plus auth_basic_user_file. You can also wrap the whole result in a server block or a location block, ready to paste into an Nginx config.

Apache and Nginx don't map onto each other one-to-one — a few constructs (multiple ANDed RewriteConds, the OR flag, custom redirect status codes, Header unset, per-mime Expires rules with no matching extension) have no direct Nginx equivalent. When the converter hits one of these it leaves the original line in place as a commented warning instead of guessing, so nothing gets silently dropped or silently wrong; turn warnings off once you've reviewed them if you want a clean file.

Everything runs locally in your browser — your server configuration is never uploaded anywhere, which matters since a .htaccess file can reveal internal paths and access rules. Copy the result, download it as a .txt file, or send it straight to another tool's input to keep refining it.

FAQ

Does this produce a complete, ready-to-use Nginx config?
It produces the equivalent directives, but Nginx and Apache don't map one-to-one — always review the output, especially anything marked with a warning comment, before deploying it.
What happens to rules with no direct Nginx equivalent?
They are left in the output as a commented line explaining that manual review is needed, instead of being silently dropped or incorrectly converted. Turn off "Show warnings" to omit them entirely.
Can it convert RewriteRule chains with multiple conditions?
A single RewriteCond above a RewriteRule is converted into an if block. Multiple ANDed conditions or the OR flag have no clean Nginx equivalent and are flagged as a warning instead of guessed at.
Does it handle Basic authentication?
Yes — a complete AuthType Basic / AuthName / AuthUserFile / Require valid-user block converts to auth_basic and auth_basic_user_file. AuthType Digest has no Nginx equivalent and is flagged.
Is my .htaccess file uploaded anywhere?
No. The conversion runs entirely in your browser — your configuration, including any paths or access rules it reveals, never leaves your device.