Welcome! Log In Create A New Profile

Advanced

Rewrite file.html as index.php?p=file.html

Posted by jstalin 
Rewrite file.html as index.php?p=file.html
September 10, 2015 10:42AM
Hello all,

I'm trying to configure nginx to rewrite a subdirectory so that when any .html file is requested it is rewritten on the back end to a php args. So far I have the following:

location /subdirectory/ {
try_files $uri /subdirectory/index.php?p=$args;
}

However, whenever I request an html file it just give me a 404. I'm not sure how to tell nginx to include .html files in the rewrite. Any help is appreciated.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 80
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready