Matomo Analytics

The short answer here is: you can't. NGINX does not provide native htaccess support. However, that doesn't mean it isn't possible at all.

It is possible to convert htaccess rules to NGINX rules so you can still get the same behavior. There are numerous tools out there that can easily convert something like this:

RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^ index.php [L]

Into valid NGINX rules, a few of those tools summed up:

NGINX even wrote a blog article about converting the htaccess rules to NGINX rules.

Considering the above htaccess example, most tools will convert them into something like this:

server {
    location / {
        try_files $uri $uri/ /index.php$is_args$args;

18 August 2021 (last updated 1 year ago)


Back to Server