# Why is Hugo server doing HTTP redirects?

**URL:** <https://discourse.gohugo.io/t/why-is-hugo-server-doing-http-redirects/852>\
**Category:** support\
**Created:** [March 8, 2015, 6:50pm UTC](https://discourse.gohugo.io/t/why-is-hugo-server-doing-http-redirects/852 "2015-03-08T18:50:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![xaprb](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/xaprb/32/290_2.png) [@xaprb](https://discourse.gohugo.io/u/xaprb)\
**Post date:** [March 8, 2015, 6:50pm UTC](https://discourse.gohugo.io/t/why-is-hugo-server-doing-http-redirects/852/1 "2015-03-08T18:50:35Z")

</div>

I’m running Hugo in server mode for editing my site:

```
hugo server --watch

```

Hugo is not behaving like a static site’s plain http server might. For example if I type in

```
http://localhost:1313/index.html

```

into my browser’s address bar, Hugo is doing a redirect. Here’s what curl outputs:

```
$ curl -v http://localhost:1313/index.html
* Hostname was NOT found in DNS cache
* Trying ::1...
* Connected to localhost (::1) port 1313 (#0)
> GET /index.html HTTP/1.1
> User-Agent: curl/7.37.1
> Host: localhost:1313
> Accept: */*
> 
< HTTP/1.1 301 Moved Permanently
< Location: ./
< Date: Sun, 08 Mar 2015 18:44:24 GMT
< Content-Length: 0
< Content-Type: text/plain; charset=utf-8

```

That isn’t how my web server behaves; it lets me view the index.html (which does exist, of course, and has content). I think Hugo is being too smart here, but perhaps there is a reason for this?

---

<div class="post-metadata">

**Author:** ![anthonyfok](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/anthonyfok/32/106_2.png) [@anthonyfok](https://discourse.gohugo.io/u/anthonyfok)\
**Post date:** [March 10, 2015, 6:14am UTC](https://discourse.gohugo.io/t/why-is-hugo-server-doing-http-redirects/852/2 "2015-03-10T06:14:22Z")

</div>

Hi @xaprb,

Very “interesting” behaviour indeed! But a quick look in [hugo/commands/server.go](https://github.com/spf13/hugo/blob/master/commands/server.go) did not show anything “interesting”, hinting that it is Go’s own `net/http` “normal” behaviour, which led me to this:

- net/http: undocumented ServeFile index.html redirect behavior  
[https://github.com/golang/go/issues/9876](https://github.com/golang/go/issues/9876)

And the code is a few lines from the top of `serveFile()` here: [http://golang.org/src/net/http/fs.go#L342](http://golang.org/src/net/http/fs.go#L342)

Cheers,  
Anthony
