: Trailing slash, google search console and sitemap I force usage of trailing slash for all of my pages under https://example.com, however the main domain remains without it - from what I've read
I force usage of trailing slash for all of my pages under example.com, however the main domain remains without it - from what I've read it's OK to do so, but I'm not sure how does Google 'understand' it.
So I got:
example.com (https://example.com/ changes to example.com) https://example.com/blog/ example.com/blog (which changes to example.com/blog/) etc.
Questions:
is it ok that my main page remains without trailing slash? From what I've observed it's typical behaviour of 99% domains.
should I use in Google search console example.com or example.com/ ? Currently I got example.com/ and I wonder if it's a huge problem.
Which one should I indicate in a sitemap? Currently I got example.com
If someone is interested, I paste also a part of my .htaccess file:
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ %{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} ^www.(.+)$ [NC]
RewriteRule ^ %1%{REQUEST_URI} [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*[^/])$ // [L,R=301]
RewriteRule ^blog/$ sites/blog.php [NC,L]
RewriteRule ^mobile/$ index.php [NC,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9} /(.*)index.php($| |?)
RewriteRule ^ /%1 [R=301,L]
More posts by @Kaufman445
1 Comments
Sorted by latest first Latest Oldest Best
When it comes to the "main domain" (ie. no apparent URL path) there is really only one URL. That is, the one with a trailing slash:
//example.com/
However, Google "understands" this and essentially "fixes" any URL where the slash is omitted. So, //example.com and //example.com/ are really the same. So, yes, it doesn't much matter.
Google always shows a trailing slash on the main domain in the SERPs.
Any URL you see in the browsers address bar where the trailing slash on the domain is omitted is purely cosmetic - in the browser. These days browsers are a bit notorious for making the visible URL look more friendly (omitting the scheme and even the query string in some browsers by default). However, if you look at the underlying request the browser is making, it is the same, regardless of whether you type the trailing slash or not. The trailing slash is present in the request (as the URL-path), because the HTTP request is simply not valid with an entirely "empty" URL-path.
domain.com (https://domain.com/ changes to domain.com)
To be clear, it is the browser that removes the trailing slash in the visible URL in the address bar, before the request is even sent to your server. As mentioned, this is purely cosmetic. Google Chrome and Firefox remove the trailing slash, IE11 does not. Opera removes the trailing slash (as well as the query string!) by default, however, this can be changed in Settings > User interface > "Show full URL in combined search and address bar" - you then get to see everything... the scheme, trailing slash on the domain and query string!
You've quoted your .htaccess code... However, your code is not doing anything with regards to slashes on the main domain. And nor can you influence the trailing slash on the main domain with server-side code.
To answer your specific questions...
is it ok that my main page remains without trailing slash? From what I've observed it's typical behaviour of 99% domains.
This has nothing to do with the domain, or even your server. In order for the user agent to construct a valid HTTP request there must be a slash present in the URL-path. But yes, it's "OK".
should I use in Google search console example.com or example.com/ ? Currently I got domain.com/ and I wonder if it's a huge problem.
I don't think you really have a choice. GSC automatically appends a trailing slash on the domain.
Which one should I indicate in a sitemap? Currently I got example.com.
Strictly speaking you should include the trailing slash. The Google references I've seen, and the Sitemaps Protocol site itself all reference the main domain URL with a trailing slash. However, in reality it's not really going to matter. Any URL processing engine will "fix it".
Related question:
Is trailing slash automagically added on click of home page URL in browser?
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.