# How do I get pretty URLs?

**URL:** https://discourse.gohugo.io/t/how-do-i-get-pretty-urls/27765
**Category:** support
**Created:** [August 23, 2020, 3:21am UTC](https://discourse.gohugo.io/t/how-do-i-get-pretty-urls/27765 "2020-08-23T03:21:04Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![zarahzachz](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/zarahzachz/32/12208_2.png) [@zarahzachz](https://discourse.gohugo.io/u/zarahzachz)
#### Post date: [August 23, 2020, 3:21am UTC](https://discourse.gohugo.io/t/how-do-i-get-pretty-urls/27765/1 "2020-08-23T03:21:04Z")

</div>

I’m new to Hugo and ran into a hiccup regarding creating my site’s navigation.

**Problem:** My site’s urls all require `/index.html` at the end of the URL string. From what I’ve read in the docs, PrettyUrls should be enabled by default thereby preventing this kind of behavior (unless I’ve misread?).

Unfortunately, my repo is private. But my nav structure looks like this:

```auto
<ul>
    <li><a href="{{ "/index.html" | absURL }}">Foo</a></li>
    <li><a href="{{ "/bar/index.html" | absURL }}">Bar</a></li>
</ul>

```

Navigating to my site’s pages results in a URL that looks like this: www. mysite. com/index. html

I want the URL to read: www. mysite. com/

I’ve made no modifications to the site’s config and have attempted setting `hugo -e HUGO_PRETTYURLS=true` in my terminal to see if I can build something without the `/index.html` ending. I get the same results every time.

---

<div class="post-metadata">

### Author: ![zarahzachz](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/zarahzachz/32/12208_2.png) [@zarahzachz](https://discourse.gohugo.io/u/zarahzachz)
#### Post date: [August 23, 2020, 3:22am UTC](https://discourse.gohugo.io/t/how-do-i-get-pretty-urls/27765/2 "2020-08-23T03:22:34Z")

</div>

I should also note that I’ve played with different `href` values - omitting the “index.html” part. Doing that just results in a broken link on my site.

The nav example I provided is the only configuration I made that didn’t break my links.

---

<div class="post-metadata">

### Author: ![ju52](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/ju52/32/6749_2.png) [@ju52](https://discourse.gohugo.io/u/ju52)
#### Post date: [August 23, 2020, 8:29am UTC](https://discourse.gohugo.io/t/how-do-i-get-pretty-urls/27765/3 "2020-08-23T08:29:19Z")

</div>

1st  
read the doc

> **[URL Management](https://gohugo.io/content-management/urls/#pretty-urls)**
>
> Hugo supports permalinks, aliases, link canonicalization, and multiple options for handling relative vs absolute URLs.

don’t set the uglyurl value in config

2nd  
I use `href ="/"` in my main menu

PS

my navigation template looks like

`<li><a href={{ .URL }}>{{ .Name | markdownify }}</a></li>`

---

<div class="post-metadata">

### Author: ![zarahzachz](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/zarahzachz/32/12208_2.png) [@zarahzachz](https://discourse.gohugo.io/u/zarahzachz)
#### Post date: [August 23, 2020, 3:52pm UTC](https://discourse.gohugo.io/t/how-do-i-get-pretty-urls/27765/4 "2020-08-23T15:52:35Z")

</div>

Unfortunately none of these recommendations worked.

I don’t have uglyurl set in my config. And after updating my nav template to match yours (and the menu docs for Hugo), I’m still seeing the `index.html` in my URL.

---

<div class="post-metadata">

### Author: ![sephore](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/sephore/32/11673_2.png) [@sephore](https://discourse.gohugo.io/u/sephore)
#### Post date: [August 23, 2020, 5:26pm UTC](https://discourse.gohugo.io/t/how-do-i-get-pretty-urls/27765/5 "2020-08-23T17:26:21Z")

</div>

I’m afraid we’re going to need more details.

---

<div class="post-metadata">

### Author: ![zarahzachz](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/zarahzachz/32/12208_2.png) [@zarahzachz](https://discourse.gohugo.io/u/zarahzachz)
#### Post date: [August 23, 2020, 7:17pm UTC](https://discourse.gohugo.io/t/how-do-i-get-pretty-urls/27765/6 "2020-08-23T19:17:14Z")

</div>

It’s cool. By setting the `uglyurl` to true, I’m a little closer to what I want.

For more context, my directory is set up as follows:

```auto
.
└── content
    └── events
        └── index.md  

```

Based on the [examples](https://gohugo.io/content-management/organization#page-bundles) in the [docs](https://gohugo.io/content-management/urls/#ugly-urls), I expected the url to be something like https:// example .com/events/, but instead I’m getting https:// example .com/events/index.html

By setting `uglyURLs = true`, I now get https:// example .com/events.html - which is closer to what I wanted.

Thanks for your help on this, but I think I’m good.
