: Is a trailing slash appropriate before URL parameters? I understand that http://www.example.com/product and http://www.example.com/product/ can actually be seen as 2 different URLs and is probably
I understand that
www.example.com/product
and
www.example.com/product/
can actually be seen as 2 different URLs and is probably best avoided for SEO purposes, but how does this affect querystring parameters. Which is better (or even 'legal')?
www.example.com/product?source=googleps
or
www.example.com/product/?source=googleps
Do you need the trailing slash before the ?
More posts by @Sherry384
2 Comments
Sorted by latest first Latest Oldest Best
All four of your URLs are different for SEO:
www.example.com/product http://www.example.com/product/ www.example.com/product?source=googleps http://www.example.com/product/?source=googleps
It doesn't matter which one of those four you use, but you have to pick one and use it consistently. Both slashes and parameters create new URLs to search engines. Serving the same content with different URLs can cause search engine crawlers to do extra work and not crawl, index, and rank your site efficiently.
You can use several tools to combat this:
Redirect all duplicate URLs to your preferred "canonical" URL.
Use the link rel canonical meta tag to tell the search engines which one to use.
Use the "URL parameters" setting in Google Webmaster Tools to tell Google that the "source" parameter doesn't change the page content (it is only used for tracking).
Both versions of your URL with parameters are "legal". The trailing slash can be there if you choose, or you can omit it. Use whichever is easier for you to configure on your server and use your choice consistently.
Regarding the SEO, I wouldn't expect it to be an issue, as Google have enough common sense to realise that, if the two URLs you have shown returned the same content, that for all practical purposes the URLs the same to a human.
In fact some webmasters/developers will write brief rewrite rules to append or remove the slash because "it looks nicer".
These rewrites may be internal HTTP server redirects (which are not visible to external user agents) and for Google to "expect" webmasters to code a dedicated redirect and corresponding round trip communication between server and user-agent which "announces" a redirect (and therefore a canonical URL) - e.g. a HTTP response with 30x and a "Location: [old URL except with a slash on it]" - and punish those who dont - doesn't make much sense.
However I don't work for Google so I couldnt say for sure - I just personally would bother with it, and you can always specify the canonical URL using the "rel" canonical tag.
If the URLs deviated any more and still returned the same content, e.g.
www.example.com/product.html http://example.com/product/
Then I would clean them up and specify canonical URL.
In my experience - with PHP - if the query string REQUEST_URI (portion of address following the HTTP_HOST which contains the REQUEST_URI and the QUERY_STRING) has a slash or not - PHP doesnt seem to care - the slash will be captured in the $_SERVER['REQUEST_URI'] array key and the query string in the $_SERVER['QUERY_STRING'] key
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.