When developing new Umbraco sites, I always use directory urls (without the aspx extension).
However, I just discovered that in some cases the .aspx pages are indexed by google instead of the extension-less equivalent. Is there any way to prevent this?
Also when I browse to a specific page, for example www.mydomain.com/about, i notice that it is also accessible through www.mydomain.com/about.aspx. If possible I would like to have only the extension-less url available (with the .aspx page doing a 301 redirect).
You could also try using the Cononcial meta tag package which adds a canonical meta tag to all your pages, and tells google which version should actually be indexed.
Good to learn about the canonical link package, Matt. Very nice for doing some extra SEO optimization! I will certainly use this in the future. Do all search engines support the canonical tag already?
For now, I'll just stick with the good old redirect rules that Ove shared here. These probably spared me a serious regex headache...! ;-)
Hi, just as a reference: The redirect rules work great, but i had to make one small adjustment in order to keep my rest extensions working. This is exluding the /base path from the redirect rule. See code below.
Google and extension-less urls
Hi,
When developing new Umbraco sites, I always use directory urls (without the aspx extension).
However, I just discovered that in some cases the .aspx pages are indexed by google instead of the extension-less equivalent. Is there any way to prevent this?
Also when I browse to a specific page, for example www.mydomain.com/about, i notice that it is also accessible through www.mydomain.com/about.aspx. If possible I would like to have only the extension-less url available (with the .aspx page doing a 301 redirect).
Does anyone have some guidelines about this?
Thanks a lot!
Chris
Hi Chris,
You can handle this in IIS7 (using a custom rewrite rule), or using a rule in the UrlRewriting.config.
I don't have an example to hand right now... but can find one later if you need?
Cheers, Lee.
Hi Lee,
Thanks for your reply! I suppose something like the following would do the trick?
Or is this not a 301 redirect?
Does google also see http://www.mydomain.com/about (without ending slash) and http://www.mydomain.com/about/ (with ending slash) as different urls or not?
Thanks,
Chris
Hey Chris,
You could also try using the Cononcial meta tag package which adds a canonical meta tag to all your pages, and tells google which version should actually be indexed.
http://our.umbraco.org/projects/developer-tools/canonical-meta-link-package
Matt
Google indexes http://www.mydomain.com/about (without ending slash) and http://www.mydomain.com/about/ as two different web pages
According to http://www.alistapart.com/articles/slashforward/ you should always append a trailing slash.
Here is a rewrite rule for that:
Note: I have changed the RemoveExtension slightly to not touch anything in the /umbraco/ folder, as it messes stuff up in the backend.
Thanks for these great insights, guys!
Good to learn about the canonical link package, Matt. Very nice for doing some extra SEO optimization! I will certainly use this in the future. Do all search engines support the canonical tag already?
For now, I'll just stick with the good old redirect rules that Ove shared here. These probably spared me a serious regex headache...! ;-)
Hi, just as a reference: The redirect rules work great, but i had to make one small adjustment in order to keep my rest extensions working. This is exluding the /base path from the redirect rule. See code below.
Thanks again for the great help!
Chris
is working on a reply...