lacks proper redirect for subdirectories (BB-3910)

Issue #3856 closed
Wolfgang Scherer
created an issue

I checked the server response for my subdirectory and saw that links without a trailing slash do not get a 301 redirect from nginx. should get a 301 redirect to, so that the browser knows how to construct relative links correctly.

But I can live with my workaround (see anonymous post at

Comments (8)

  1. Wolfgang Scherer reporter

    Here is a nice short workaround, that can be used in a script element on the index.html page:

    From: David Chambers [Atlassian]

    if (!/(\.html|\/)$/.test(location.pathname)) location.pathname += '/'
  2. Wolfgang Scherer reporter

    On second thought, it probably should be fixed on the server side, in order for automatic crawling and the browser "Back" button to work correctly.

    This is what I get from my apache2 server, when I access a directory link that is automatically served with an index.html:

    (unset LANG LANGUAGE; wget -O - --save-headers
    --2012-04-03 11:21:15--
    Connecting to||:80... connected.
    HTTP request sent, awaiting response... 301 Moved Permanently
    Location: [following]
  3. mackyle

    Has this been fixed?

    Fetching the example seems to be producing the desired 301 redirect now:

    * About to connect() to port 80 (#0)
    *   Trying connected
    > GET /ws-vacation HTTP/1.1
    > Host:
    > Accept: */*
    > User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)
    < Server: nginx/1.0.6
    < Date: Mon, 17 Dec 2012 17:59:57 GMT
    < Content-Type: text/html; charset=utf-8
    < X-Request-Count: 36
    < Content-Length: 0
    < X-Served-By: bitbucket02
    < Vary: Cookie
    < X-Version: 309704b5e60d
    < ETag: "d41d8cd98f00b204e9800998ecf8427e"
    < Location:
    < X-Static-Version: 309704b5e60d
    < Strict-Transport-Security: max-age=2592000
    * Connection #0 to host left intact
    * Closing connection #0
  4. Log in to comment