Is it possible to rewrite or redirect if you access a page and the URL doesn’t match the canonical link to the correct canonical link?
If so how would I go about this? I assume it is going to be something along the lines of get the url, compare it to canonical, if it doesn’t match then rewrite/redirect to correct URL in canonical?
Have a look here.
http://www.seo-consultant-services.co.uk/301-redirects-www-non-www-canonical-problems.html