Carrying on from some help Aaron (awardle) gave me with ISAPI Rewrite, here is my less than perfect solution for SEO Stricter URL’s on IIS :
The idea is to stop search engines potentially indexing multiple ways of accessing of the same page by creating a permanent 301 redirect.
For example, 8 ways of accessing one page:
[tt]yourdomain.com/test.html
yourdomain.com/index.php?id=24
yourdomain.com/test
yourdomain.com/test/
www.yourdomain.com/test.html
www.yourdomain.com/index.php?id=24
www.yourdomain.com/test
www.yourdomain.com/test/[/tt]
Some of the examples are not likely to be an issue, but some could be.
Friendly URL’s should be enabled in the Manager and I’ve assumed you’ve used the .html suffix.
Assuming you have ISAPI Rewrite 2 from
http://www.helicontech.com/ ( I don’t know if this would work with the Lite version?)
You need to create a file named httpd.ini in the root of your site.
The first part of the file should contain:
[ISAPI_Rewrite]
# 3600 = 1 hour
CacheClockRate 3600
RepeatLimit 32
# Block external access to the httpd.ini and httpd.parse.errors files
RewriteRule /httpd(?:\.ini|\.parse\.errors).* / [F,I,O]
# Block external access to the Helper ISAPI Extension
RewriteRule .*\.isrwhlp / [F,I,O]
RewriteEngine On
RewriteCond Method GET|HEAD
RewriteRule /(?!(?:manager|assets)/)(.*)\.html(?:\?(.*))? /index.php?q=$1?2&$2: [I,L,U]
To force
yourdomain.com =>
www.yourdomain.com =>
www.yourdomain.com/index.html and
www.yourdomain.com/index.php?id=1 =>
www.yourdomain.com/index.html add this:
RewriteCond Host: yourdomain.com
RewriteRule (.*) http://www.yourdomain.com$1 [I,RP]
RewriteRule (.*)/index.html http://www.yourdomain.com/ [I,RP]
RewriteRule /index\.php\?id\=1 /index.html [I,RP]
For other pages I add more rules:
RewriteRule /anot(.*) /another-page.html [I,RP]
RewriteRule /index\.php\?id\=51 /another-page.html [I,RP]
By using the first few letters of the page name i.e.
anot rather than the full name it helps catch any bad spelling.
Just ensure you use enough letters to make the page unique, or otherwise you could redirect several pages to one!
Repeat for each page you want to redirect.
Probably not the most elegant solution, but it seems to work.
Good luck!
David