Quantcast
Viewing latest article 9
Browse Latest Browse All 9

Fixing the trailing slash in Nginx

The solution as usual is super simple. The problem I was having was that when you didn’t put a trailing slash on a url, it would not handle it and throw a 404. I saw lots of fixes with complex re-write rules, but it turns out that a simple fix for me was to add this to my .conf file:

# http://wiki.nginx.org/NginxHttpCoreModule#server_name_in_redirect
server_name_in_redirect off;

So your *.conf would look like this

server {
  listen  80;
  server_name  localhost;
  ...
  server_name_in_redirect off;
  ...
}

Viewing latest article 9
Browse Latest Browse All 9

Trending Articles