Nginx Rewrites not working

I just switched from Apache 2 to Nginx and my rewrites are not working. Main page loads fine, any link is a error 404. Xen Foro is installed in the root directory for the domain.

I have the following added to the virtual host file for my donain in sites-enabled.

Code:
 location / {


            index index.php;


            try_files $uri $uri/ /index.php?$uri&$args;

  }

   location /install/data/ {


        internal;


        }

 location /install/templates/ {


        internal;


        }


   location /internal_data/ {


        internal;


        }



        location /library/ {


        internal;


        }




        location /src/ {


        internal;


        }

OS is Ubuntu 20.20 using php 8.3
 
rewrites are not working.
Here's what works ...

Code:
        location ~ ^/(src|internal_data|library)/(install\/data)/(install\/templates)/(.*)$ {
                internal;
        }

        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to index.html
                try_files $uri $uri/ /index.php?$uri&$args;
        }
 
Here's what works ...

Code:
        location ~ ^/(src|internal_data|library)/(install\/data)/(install\/templates)/(.*)$ {
                internal;
        }

        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to index.html
                try_files $uri $uri/ /index.php?$uri&$args;
        }

You sir are a friggin ROCK STAR!!! That fixed it!
 
Back
Top Bottom