: Canonical or redirecting When I have a page with the URI lets say www.example.com/page there might be the possibility that users or links end up sending the user to pages like this: www.example.com//////page?
When I have a page with the URI lets say example.com/page there might be the possibility that users or links end up sending the user to pages like this: example.com//////page?
I could just use a canonical on the page which refers to example.com/page, but my fist question is whether a redirection via PHP with:
header ("Location: www.example.com/page )
might be more useful. It is definitely more user-friendly, which should be the overall goal.
My second question now is, in case I use the canonical, should I include the canonical tag into the page standard html or should I just put it in there via PHP if the canonical differs from the current page URI?
More posts by @Murray155
1 Comments
Sorted by latest first Latest Oldest Best
The redirect is the better solution, as it stops the erroneous URLs ever being linked to or shared, and so should help crawl efficiency (i.e., search engines shouldn't have to crawl multiple non-canonical versions of pages, thereby wasting time that could be spent elsewhere on your site).
I'd do your redirects on the server though, if possible. A fairly simple regular expression will catch all manner of undesirable URL variants (e.g., jumbled case, with and without trailing slash, etc.).
You don't need to apply the canonical link element conditionally: it can always be there, regardless of whether the page is being shown on a non-canonical URL or not. Even Google do this.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.