[Resolved] Nginx Friendly URL Config For Multiple Directories/Installs

John917

Active member
Solution:
It seems like there isn't a real solution to this since by default things are working as they should.
Any time ahref is linked without the domain name, it will always omit the slug on the current page no matter the nginx setting. So please ignore this post.

-------------OLD-----------------
So I've noticed there's a lot on configuring NGINX for single installs (single /forums/) directory, but I've been trying to get it work with multiple installs (/forum1/ /forum2/).

I think this is helpful for test servers and almost got it working with:

Code:
    location ~ /$ {
        try_files $uri $uri/ /index.php?$uri&$args;
        index index.php index.html index.htm;
    }

    location /install/data/ {
        internal;
    }
    location /install/templates/ {
        internal;
    }
    location /internal_data/ {
        internal;
    }
    location /library/ { #legacy
        internal;
    }
    location /src/ {
        internal;
    }

    if (!-e $request_filename){
        rewrite ^(/forum1/.*)$ /forum1/index.php break;
    }
    if (!-e $request_filename){
        rewrite ^(/forum2/.*)$ /forum2/index.php break;
    }

Although this works for home redirects, it doesn't work with ahref url's that link without the domain.com name. So for example:
"/slug/slug.html" instead of "www.site.com/forum1/slug/slug.html" makes it link to "www.site.com/slug/slug.html"
So in other words, it's omitting the slug /forum1/.

Any idea how I can fix this?
 
Last edited:
Top Bottom