• Hi there–

    I’m trying to run my wordpress install, on nginx, with NO trailing slashes. Using a custom permalink structure and the following rules, I successfully have it running for all pages/posts and admin pages except for the homepage. My homepage has a redirect loop. Does anybody have suggestions for either a better overall way of doing this, or a specific override fix to just get the homepage working (since everything else works fine)?

    Many thanks to anybody who can help!

    Relevant nginx server (virtual host) config I’ve been trying:

    rewrite ^/(.*)/$ /$1 permanent; #Remove trailing slashes
    rewrite ^/blog$ /blog/index.php;
    location /blog/ {
            rewrite ^/(.*)/$ /$1 permanent; #Remove trailing slashes
            try_files $uri $uri/ /blog/index.php?q=$uri&$args; #General wordpress rewrite
    }

    (The redirect loop goes from url.com/blog to url.com/blog/ and repeats.)

  • The topic ‘Nginx no trailing slash (redirect loop)’ is closed to new replies.