Tools

.htaccess to Nginx Converter

Paste your .htaccess and get the nginx rules to start from. It runs in your browser, and anything it cannot convert is marked for you to check.

nginx
# The nginx rules appear here.

What it converts

  • WordPress and Laravel front-controller rules, to a single try_files line.
  • Force HTTPS, and www or non-www redirects.
  • Redirect, RedirectMatch and simple RewriteRule lines, including 301 and 302 flags.
  • Blocked files (<Files> with Require all denied), Deny from / Allow from, and password protection.
  • Header set, ErrorDocument, DirectoryIndex and Options -Indexes.

PHP settings such as php_value do not belong in nginx at all; the tool tells you where they go instead. For the background, read why nginx ignores .htaccess.

Frequently asked questions

Does nginx read .htaccess files?

No. Nginx has no per-folder configuration files, so rules in .htaccess are ignored. They have to be written into the site's server block, which nginx reads when it starts or reloads.

Where do I paste the converted rules?

Inside the site's server { ... } block, usually in a file under /etc/nginx/sites-available or /etc/nginx/conf.d. Then run nginx -t to check the syntax and reload nginx.

Is the conversion always exact?

No converter can be. Apache and nginx process rules differently, so test every redirect and protected folder after the change. Anything this tool cannot convert is marked CHECK BY HAND rather than left out.

Is my .htaccess sent anywhere?

No. The conversion runs in your browser. Nothing is uploaded to GHP Cloud or stored.

Moving sites from a cPanel or Apache host? GHP runs on nginx and writes each site's server block for you, with WordPress rules already in place.

Open the migration checklist