Pretty URL on NGINX and queries in the URL not working

For discussion and questions related to CMS Specific templates and stylesheets (CSS), and themes. or layout issues. This is not a place for generic "I don't know CSS issues"
Post Reply
jpa
Forum Members
Forum Members
Posts: 14
Joined: Wed Jun 17, 2009 11:31 am

Pretty URL on NGINX and queries in the URL not working

Post by jpa »

I'm sorry if I put this question in the wrong category, but I could not find another, more suitable category.

I have moved a CMSMS site from an apache server to a new server that runs NGINX. I set up the NGINX config to allow for pretty URLs as advised:

Code: Select all

location / {
        try_files $uri $uri/ /index.php?page=$request_uri;
}
But one of the pages in this CMS uses queries in the URL to filter the content. Like https://domain.com/accesspage?foo=bar

This URL is not working on the NGINX server, but if I add an & in front of foo=bar, it works. https://domain.com/accesspage?&foo=bar

It's as if the URL is rewritten as https://domain.com/index.php?page=accesspage?foo=bar, and that, of course, does not work

Has anyone else run into this problem?

Is there a way to edit the try_files or to add a separate rewrite rule, to make this URL work as intended: https://domain.com/accesspage?foo=bar
jpa
Forum Members
Forum Members
Posts: 14
Joined: Wed Jun 17, 2009 11:31 am

[SOLVED] Re: Pretty URL on NGINX and queries in the URL not working

Post by jpa »

After some trying and failing, it seems as if I was on the right path all along, but forgot an important & in the string.

When I changed the try_files to the following, it works:

Code: Select all

try_files $uri $uri/ /index.php?page=$request_uri&$args;
Post Reply

Return to “Layout and Design (CSS & HTML)”