Sponsored By: Password Angel - Share passwords, API keys, credentials and more with secure, single-use links.

Ask Chris Shennan: Why would you want to let your hosting platform dictate your URL structure?

I posted my Decorate the Symfony router to add a trailing slash to all URLs to and was asked an interesting question

If there is no solution for removing the trailing slashes with S3 static hosting; I suggest you use another hosting platform.

Why would you want to let you hosting platform dicate your url structure?

Good question. I can think of a couple of reasons why using another host, or changing the trailing slash behaviour at the provider may not be viable.

  • It's not your choice - Most of us don't get a choice of where our application is hosted. Commercial agreements are already in place, often spanning multiple years so we have to work with what's available.
  • Red tape - A change in provider, or even a trailing slash configuration at the infrastructure level might require a change request to be raised with a separate DevOps teams. For something like changing the trailing slash policy, this will likely be at the bottom of their list. Managing this within your application can mean it's resolved in hours rather than days or weeks.
  • Complexity/Flexibility - This isn't just an AWS issue. Many static site host solutions have trailing slashes at the end of their URLs out of the box, and there are workarounds to remove them (including for AWS). Developers aren't always aware of the infrastructure that their application runs on (although a basic understanding of it is beneficial). Keeping the application routing within the application rather than a separate DevOps function, which is possibly not available for developers to see, reduces cognitive complexity and offers greater flexibility in the future (no request needs to be raised with DevOps for a change).
  • Convenience - (and I fall into this) - I could use another host but Password Angel is one small project amongst several others using several AWS features. While I could separate it, having all my projects in one place greatly outweighs any benefit that would come from splitting them into multiple providers to overcome a trailing slash minor inconvenience. Ultimately having a trailing slash or not isn't a big deal - search engines can handle both just fine and static site providers tend to automatically redirect non-trailing slash URLs to ones with trailing slashes i.e. will redirect to (so no broken links!) - what is important is consistency.

The pros and cons of which provider to use and whether to use a trailing slash or not are beyond the scope of this article but having decided you want a trailing slash at the end of your URLs, this article is aimed at showing you how to achieve that with minimal effort and fuss.

Enjoyed this article?

Thank you for reading this article! If you found the information valuable and enjoyed your time here, consider supporting my work by buying me a coffee. Your contribution helps fuel more content like this. Cheers to shared knowledge and caffeine-fueled inspiration!

Buy me a coffee

Originally published at

Subscribe to my newsletter...

... and receive the musings of an aspiring #indiehacker directly to your inbox once a month.

These musings will encompass a range of subjects such as Web Development, DevOps, Startups, Bootstrapping, #buildinpublic, SEO, personal opinions, and experiences.

I won't send you spam and you can unsubscribe at any time.