Okay, by default my urls structure is in mixed case, e.g domain.com/Green-Blue-Widgets.html and Google for some reasons is indexing two versions of my urls domain.com/Green-Blue-Widgets.html and domain.com/green-blue-widgets.html . Now i want to 301 redirect all urls to lowercase, but my internal navigation is all mixed case e.g the category page domain.com/Green has all the products listed in the page with mixed case. I know its bad programming, but i will really appreciate if any one can look into the matter for me and usggest a solution.
Hi, Are the urls in a fixed format? as shown above, where the first letter only uppercase or more complext than that? Also how complex is the url path? as above or with folders too? The task is mostly using .htaccess rather than php... I'll try a few htaccess methods and post back soon Si
The simplest solution is to use the rel="canonical" tag on your webpages. All of the major search engines support this tag and will eventually canonicalize your URLs in their index. Of course, you should also work to homogenize all of your internal links to match the canonical URLs you use. See Google's Recommendation for details. Good luck!
Hi, I've looked into it.. there are a few ways, htaccess only is really ugly and can slow things down a lot. So I came up with this... yout .htaccess needs to be changed to add this: RewriteEngine on RewriteCond %{REQUEST_URI} [A-Z] RewriteRule (.*) http://yourdomain.com/urlw.php?u=$1 [R=301,L] Code (markup): this basically detects if upper case characters are present, if so, it then redirects to the php script so if you entered http://yourdomain.com/Apple-Pie.php Code (markup): it would redirect to http://yourdomain.com/urlw.php?u=Apple-Pie.php Code (markup): urlw.php is as follows: <?php $URL = $_REQUEST['u']; // incoming url $URL = strtolower($URL); // force lower case $URL = strip_tags($URL); header("Location: ".$URL, TRUE, 301); ?> Code (markup): this gets the filename, forces it to lower case, does a bit of safety checking of the string, then performs a 301 redirect Hope this helps? Si