The website URL is http://example.com but some pages have been redirected to http://example.com/, the version of the URL with the trailing slash. Should I change all redirects to the non-trailing-slash URL?
Asked
Active
Viewed 1,164 times
3
Stephen Ostermiller
- 98,758
- 18
- 137
- 361
Maryam Beheshti
- 389
- 2
- 10
1 Answers
3
Homepage: Google has stated that the homepage doesnt really matter if there is or isnt a trailing slash.
Directory: directories must have a trailing slash in the end.
File/Page: an html page or an file shouldn't have a trailing slash.
John Could
- 739
- 5
- 12
-
2It's not just Google. When it comes to the home page, the HTTP spec states that there is no difference between having a trailing slash and not having one. Whether or not the slash shows in the URL, the HTTP request must include the slash. – Stephen Ostermiller Oct 16 '18 at 14:51
-
Note example.com/index.php are the same as example.com/index.php/something at least for apache. You can process this trailing uri in index.php, making possible to use different urls with same script without mod_rewrite – LeonidMew Oct 18 '18 at 00:52
http://example.comvshttp://example.com/) is different than for a directory (/foldervs/folder/). – Stephen Ostermiller Oct 16 '18 at 12:46http://example.comyou will see that your browser sends in fact aGET /request, so at least a/is mandatory to say "root". – Patrick Mevzek Oct 16 '18 at 14:57redirectwithout trailing slash will most probably fail if original request came with path like example.com/foo. it will redirect to invalid example.comfoo – Sampo Sarrala Nov 03 '18 at 03:07