remove php extension nginx mamp pro 6

Viewed 42

I'm attempting to remove the .php extension from the URL of my website in the NGINX config. This is my first time using both NGINX and MAMP Pro 6, so forgive me if the answer seems obvious (I'm used to using .htaccess).

Using some answers from this thread, I've attempted:

  • Editing the conf file directly (/Library/Application Support/appsolute/MAMP PRO/conf/nginx.conf).
  • Editing the template conf file (File > Open Template > NGINX)
  • Adding the entire server block to both of Custom* and Additional parameters for the server directive fields (attached image for reference).
  • Adding just the contents of the server block to the same above fields.

This is a fresh project and I haven't modified the NGINX config at all before this.

server {
    index index.html index.php;

    location / {
        try_files $uri $uri/ $uri.html $uri.php$is_args$query_string;
    }

    location ~ \.php$ {
        try_files $uri =404;
    }
}

Reference Image

0 Answers
Related