I'm running a clean WordPress 5.9.2 local setup. My permalink structure is this:


When I visit http://example.com/sample-page, I get redirected to http://example.com/sample-page/, just as I would expect. Yet, http://example.com does not redirect to http://example.com/, but the opposite happens.

How do I achive the redirect to the slashed home url?

  • trailing slashes for the root of a domain don't matter, and are exactly the same, the browser and server do not see a difference between those URLs. Other pages it does but not the root
    – Tom J Nowell
    Mar 30, 2022 at 18:23
  • I do realise they do not matter, so let's say I'm trying to please a bunch of pedantic SEO experts or it's my OCD pushing me to have consistency in the links behaviour across board. Is there a way to achive this, despite being a decorative useless change?
    – vlood
    Mar 30, 2022 at 18:40
  • 1
    I don't mean they lead to the same place, I'm saying the are the same place, the browser itself is changing it, there is no redirect from from / to a version without a / being shown in browser dev tools when recording the network tab with preserve log turned on, and curl commands show that both with and without return a HTTP 200 containing / on the end. What you ask doesn't make sense
    – Tom J Nowell
    Mar 30, 2022 at 19:26

1 Answer 1


What you are asking for is impossible, and if SEO consultants are asking for this then they do not know what they're talking about. WordPress is not redirecting you to a non-slashed homepage, the change happens before your browser even starts the request.

To understand why, take a look at one of the most basic HTTP requests possible:, a GET request to retrieve the root of example.com:

GET / HTTP/1.1
Host: example.com

This requests the root of a domain, but there is no way to remove the / here. If I delete it then I will be sending an invalid request to HTTP/1.1 with no protocol version afterwards.

Likewise, if you try to inspect the HTTP network traffic, you will see no redirects from example.com/ to example.com because they are the same address. I don't mean that they are equivalent, or that they lead to the same place, but that they are 100% identical. The display of the / is purely the browser being helpful, which is why visiting example.com/ in the browser will show example.com in the address bar. Being able to put a trailing slash on a root of a domain is a happy accident of how the URL spec works, and one that browsers remove to simplify the URL.

What you are asking for is impossible, and is not how HTTP works.

As a further test, you can prove this yourself:

curl -s -L -D - https://example.com -o /dev/null -w '%{url_effective}'

Run this, then run it again with a trailing /, and the output is identical. There is no redirect, and WordPress is not involved, this is much lower at the foundation of HTTP.

If you're still in doubt, try to find an example of a site that has a trailing slash in modern Chrome.

  • 1
    fun fact, if you type it into safari there is no trailing slash when you press enter, but if you select and hit the right arrow key to add more, it adds a / for you. Firefox and Chrome both remove the / automatically, all of them are sending / under the hood
    – Tom J Nowell
    Mar 30, 2022 at 19:37
  • Prior to asking here I did tests with wget leading to the same result as your curl test. I also looked for popular websites with a trailing slash so I'm not doubting your answer here. The cause of my request? Some SEO folks had reported a site having indexed both example.com and example.com/ as separate entries in their SEO tool (no info for the tool, I'm afraid). Duplicate indexed content is what bothered those guys, ending up with the request I couldn't fulfill, leading me to reaching for help here.
    – vlood
    Mar 31, 2022 at 7:52
  • it's likely the authors of their tool are unaware of this and handling raw URL strings, and that's why they show as separate URLs
    – Tom J Nowell
    Mar 31, 2022 at 9:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.