Will switching "useDirectoryUrls" to TRUE break incoming links?
Hi all,
So, I have been thinking that I'd like to switch the webconfig setting "useDirectoryUrls" to true for my site, to remove those pesky ".aspx" extensions, but I am concerned about all the external links coming into my site from different locations...
Will all those links now result in a 404 error?
Or will umbraco automatically chop off the ".aspx" and thus properly redirect them?
Or do I need to add some custom "urlrewriting" code to make this happen?
I'd just like to get an idea about what I'm in for if I make the change.
Your URLs will continue to work with the .aspx extention, so you won't get any broken links, but you may want to think about implementing a UrlRewrite rule to do a 301 redirect to the extentionless url, so that search engines don't see it as duplicate content.
(Or do not use the named reference ?<url> and use $2 here.)
So basically take everything that starts at the root of the website with a '/', ends in '.aspx' and doesn't start after the slash with 'umbraco/' or 'data/' etc. Obviously you can get more specific but that should do the trick.
Thanks to everyone for your replies. It looks like Sascha's is the closest to what I need, but when I used it with your named reference, there was an error message:
Parser Error Message: '<', hexadecimal value 0x3C, is an invalid attribute character. Line 40, position 90.
Which seems to do the redirecting properly now. (Yay!)
Now what I'd like to know is how can I verify that this is sending the proper "Permanent Redirect" message to Google? In another threa someone mentioned using Firebug to check, but I can't see where that information would be displayed.
The easiest way to test this has always been Fiddler for me, it has a huge amount of information and it can look a bit daunting at first, but it's such a great and powerful tool.
As sebastiaan says, Fiddler is a good free option, or if you don't mind a small charge you could also try Charles. Both pretty much do the same though.
This is exactly what I have been looking for - found it at last! Thank you Matt - and Heather for the wiki entry. When I initially tried this I had redirect set to "domain", which stopped this working, took me a while to spot the difference... doh
Will switching "useDirectoryUrls" to TRUE break incoming links?
Hi all,
So, I have been thinking that I'd like to switch the webconfig setting "useDirectoryUrls" to true for my site, to remove those pesky ".aspx" extensions, but I am concerned about all the external links coming into my site from different locations...
Will all those links now result in a 404 error?
Or will umbraco automatically chop off the ".aspx" and thus properly redirect them?
Or do I need to add some custom "urlrewriting" code to make this happen?
I'd just like to get an idea about what I'm in for if I make the change.
Thanks!
Heather
Hi Heather,
Your URLs will continue to work with the .aspx extention, so you won't get any broken links, but you may want to think about implementing a UrlRewrite rule to do a 301 redirect to the extentionless url, so that search engines don't see it as duplicate content.
Matt
Thanks, Matt, for your quick response and your suggestion for the redirect code.
A search in the forum turned up
http://our.umbraco.org/forum/using/ui-questions/5255-301-redirect-options
which might help me figure that out.
Have a great day!
Heather
Hmm... This is proving more challenging than I expected...
My RegEx skills are not the best, and I am wondering how I can make this work for all my current pages without hosing the whole site...
My first attempt is this:
"\/*()\.aspx" matches all the pages in the site, though, including "/umbraco/" and other "reserved" dirs.
Does anyone know how to write the regex properly?
Thanks!
Heather
Hi,
I think it would be something like this:
Hi Heather,
I reckon something like this should do the trick
Matt
Hi Heather,
that's indeed a bit tricky, I came up with the following regex:
And then
destinationUrl="${url}"(Or do not use the named reference ?<url> and use $2 here.)
So basically take everything that starts at the root of the website with a '/', ends in '.aspx' and doesn't start after the slash with 'umbraco/' or 'data/' etc. Obviously you can get more specific but that should do the trick.
Hope it works,
Sascha
Thanks to everyone for your replies. It looks like Sascha's is the closest to what I need, but when I used it with your named reference, there was an error message:
Parser Error Message: '<', hexadecimal value 0x3C, is an invalid attribute character. Line 40, position 90.
So, I made some changes... and have this:
Which seems to do the redirecting properly now. (Yay!)
Now what I'd like to know is how can I verify that this is sending the proper "Permanent Redirect" message to Google? In another threa someone mentioned using Firebug to check, but I can't see where that information would be displayed.
Does anyone know how I can test this?
~Heather
The easiest way to test this has always been Fiddler for me, it has a huge amount of information and it can look a bit daunting at first, but it's such a great and powerful tool.
Hey Heather,
As sebastiaan says, Fiddler is a good free option, or if you don't mind a small charge you could also try Charles. Both pretty much do the same though.
Matt
I think you can also check this with Firebug, in the .Net tab: all connections made are listed and the status as well.
+1 for Fiddler though as well, awesome tool. :)
Thanks everyone!
I found the "status" under the .Net tab in Firebug as Sascha suggested (had to click "All") and it said "301 Moved Permanently"
Success!
~Heather
I added a wiki page with this for anyone who might want to do the same thing:
http://our.umbraco.org/wiki/how-tos/how-to-switch-your-site-to-usedirectoryurls=true-when-it-was-previously-=false
~Heather
Awesome,
Great work.
Matt
This is exactly what I have been looking for - found it at last! Thank you Matt - and Heather for the wiki entry. When I initially tried this I had redirect set to "domain", which stopped this working, took me a while to spot the difference... doh
Thanks again!
Dan
Always glad to help, Dan - and welcome to the community!
~Heather
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.