How to canonicalise case?
2 posts
• Page 1 of 1
How to canonicalise case?
Due to a faulty sitemap some time back, there are some variants of URLs out in the wild.
Google penalises URLs with the same meta-tags, even if the URLs differ only in case (which is a pain, because some idiot could type one in wrongly, or link to it), and IIS doesn't care.
E.g. if we have "marquees-in-yorkshire.html" as a valid URL, and there's also "Marquees-in-Yorkshire.html" out there, they will both call the same URL, and Google will say you have duplicate meta descriptions.
So- I thought, let's have a rewritemap for the known bad ones.
So I constructed seofix.map, containing e.g.
/Marquees-in-Yorkshire.html /marquees-in-yorkshire.html
And added the following code into .htaccess:
#Rewrite Duplicated SEO names with a rewritemap
RewriteMap seofix txt:seofix.map
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond ${seofix:%{REQUEST_URI}|NOT_FOUND} !NOT_FOUND
RewriteRule (.*\.html) ${seofix:%{REQUEST_URI}} [L,NS,R=302,QSA]
- omitting the usual [NC] flag, so that it *will* be case-sensitive.
However, if you *do* this, it says you have a rewrite loop! Presumably because IIS doesn't care about case.
Google penalises URLs with the same meta-tags, even if the URLs differ only in case (which is a pain, because some idiot could type one in wrongly, or link to it), and IIS doesn't care.
E.g. if we have "marquees-in-yorkshire.html" as a valid URL, and there's also "Marquees-in-Yorkshire.html" out there, they will both call the same URL, and Google will say you have duplicate meta descriptions.
So- I thought, let's have a rewritemap for the known bad ones.
So I constructed seofix.map, containing e.g.
/Marquees-in-Yorkshire.html /marquees-in-yorkshire.html
And added the following code into .htaccess:
#Rewrite Duplicated SEO names with a rewritemap
RewriteMap seofix txt:seofix.map
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond ${seofix:%{REQUEST_URI}|NOT_FOUND} !NOT_FOUND
RewriteRule (.*\.html) ${seofix:%{REQUEST_URI}} [L,NS,R=302,QSA]
- omitting the usual [NC] flag, so that it *will* be case-sensitive.
However, if you *do* this, it says you have a rewrite loop! Presumably because IIS doesn't care about case.
- HeliconAndrew
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: How to canonicalise case?
Long time no see )
I'm afraid you're overcomplicating things. Take a look here - http://www.helicontech.com/isapi_rewrit ... teRule.htm - CL-flag.
If you put a rule on top of your file it will automatically lowercase everything and no idiot will spoil your google renking.
Regards
Andrew
I'm afraid you're overcomplicating things. Take a look here - http://www.helicontech.com/isapi_rewrit ... teRule.htm - CL-flag.
If you put a rule on top of your file it will automatically lowercase everything and no idiot will spoil your google renking.
Regards
Andrew
2 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 15 guests