How to hide folder path?

I’m hosting a static site with Netlify.

My site’s pages are all in a folder called ‘pages’. If I want to open something, it looks like this:

mysite.com/pages/contact-us

How can I hide the /pages path in the url?

hi @mrhello, can you post a screenshot of your build settings from netlify please?

Yes. Are these the settings you are talking about?

netlify-settings

yep. If you try tweaking these settings so to include pages you might get the result you want. Let us know if you really can’t make it work.

I’ve tried messing around… included pages in the base directory and also the publish directory, nothing works though to hide pages :pensive:

Usually then you’d use pages/ as the publish directory in the settings you picture - then all the content in public/pages in your repo will be published at / instead of at /pages

I’m not clear as to whether you have other content outside of /pages - like /assets/logo.png - that are needed by the content in /pages or not. If so, my suggestion won’t work well, and you might instead store the content in /pages in / instead?

Yes, that’s exactly what I ended up doing after messing with the settings. I stored my HTML files in / and just deleted the /pages folder.

Not sure why choosing /pages as the publish directory didn’t work. I wanted my HTML files to be a bit more organized in a separate folder, but it’s not a problem.

glad you figured it out! it’s a pretty universal pattern to have the html pages on the root level of your directory (or at the very least, the index.html) but all the assets can live in subdirectories. Good thing its working now :slight_smile: