When I visit my homepage https://example.com/ in a web browser, the trailing slash doesn't appear in the URL when I view it in the browser address bar:


However, if I now copy the address from the browser address bar (which is https://example.com) and then paste it out in my text editor, I get a trailing slash appear:


Why is the trailing slash absent when I view the URL in the browser address bar, yet not absent when I copy and paste that same URL? I don't believe .htaccess rules can explain this behaviour.

  • It's just the browser hiding an unimportant character (it'll do the same for the leading http:// but not for https). Don't overthink it. Nothing to do with server config or .htaccess. – ceejayoz Apr 22 '16 at 12:11

Why on earth do you think the .htaccess file should have anything at all to do with this?

It's a browser behavior and is the same on all sites: If you view the root page of a site, it will only display example.com to be easily readable, but it will copy a full, valid URL like http://example.com/ into the clipboard, which requires the / at the end of the host/port part.

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