|
|
 Rank: Devotee
Joined: 7/24/2008 Posts: 50 Location: Crewe, UK
|
Hi, Im sure somebody has solved this simple problem before so thought I'd ask before goin off on a tangent. I have a series of pages old articles I have imported in to a new Umbraco site and I'd lilke to setup permanent 301 redirects in the page. I'm using directory URL's and have something like this simple structure. News/News-Article1 News/News-Article2 I was canny enough on the import to include the previous page name and querystring so in effect in Umbraco I actually have this New (Nice URL) Previous URL News/News-Article1 news_item.aspx?NewsID=12 News/News-Article2 news_item.aspx?NewsID=67 What would be the best approach when someone enters this URL in the browser http://www.testsite.com/news_item.aspx?NewsID=67 to end up at the nice URL http://www.testsite.com/News/News-Article2 ???? I've looked at not found-handlers and umbracoAlias but I'm not certain if the alias includes the querystring as well? Also do the not found handlers implement a 301redirect or is it simply a 200? I realise I can do this all manually in the URLRewriting.config file but I wanted it to be a little more dynamic. Any help would be appreciated. DC
|
|
 Rank: Devotee
Joined: 6/6/2008 Posts: 83 Location: Barling Magna
|
hi ya, Have you seen this thread : http://forum.umbraco.org/yaf_postst6999_Change-http-statuscode-for-umbracoUrlAlias.aspx There's a suggestion from Morten in there about using a usercontrol to handle the 301, pick up the old page id and forward it. This is the idea that occurred to me. good luck, let us know how you get on Jay
|
|
 Rank: Devotee
Joined: 7/24/2008 Posts: 50 Location: Crewe, UK
|
I'd prefer to do this at a lower level if at all possible. I'm not sure I like the idea of 200 status codes then bumping out to a 301 redirect.
I'm not saying it's a gludge at all but it doesnt feel like best practice to have a user control on the page effectively redirecting to itself.
Anyone know if you can set the status code of not found handler?
Also in code, would anyone know how I can search the content tree for a node that has a matching value in one of it's properties? I.e. find the nodeid of a page that has "news_item.aspx?NewsID=12" as a value in a property called oldURL?
DC
|
|
 Rank: Addict
Joined: 7/20/2006 Posts: 573 Location: NL
|
DC,
if you use the URLRewriting, you can make it dynamic I think. If your articles all still have the same numer, I think you only need 1 line in the web.config. I'm no URLRewriting guru, but perhaphs you can find some examples on the forum.
HTH, PeterD
Check out the calendar with recurrence at my blog.
|
|
 Rank: Devotee
Joined: 7/24/2008 Posts: 50 Location: Crewe, UK
|
Unfortunately there is no correlation between the old URL's and the new. In fact I used the headline from the news articles as the node name.
I'd loce to get more info on dynamic URLRewriting looking at the Umbraco node tree. Guess I need to do a bit more digging.
One question that woul help loads is the one about searching the Umbraoc hierachy in c-sharrp code.
Cheers
DC
|
|
 Rank: Umbracoholic
Joined: 7/20/2006 Posts: 1,076 Location: Charleston, West Virginia, United States
|
I have a 301 Redirect Package (not public worthy, but works) that works against the 404 page. I have used it on several sites to redirect old page url's to new. It can be modified to accomplish whatever you would like. It uses regex to match urls. I also have extensions for xslt to provide redirects with specific status codes. This too can be used against the 404 page, and allows you to do your own parsing methods to find the destination page, and redirect. URL Rewrites can do the same effect, but of course it is not easily customized by end users or other scripts (events to log moves/name changes, etc).
• 2007/2008 MVP • 2008/2009 MVP • Certified • Licensing • Support • Development • Hosting •
|
|
 Rank: Devotee
Joined: 7/24/2008 Posts: 50 Location: Crewe, UK
|
neehouse wrote:I have a 301 Redirect Package (not public worthy, but works) that works against the 404 page. I have used it on several sites to redirect old page url's to new. It can be modified to accomplish whatever you would like. It uses regex to match urls.
I also have extensions for xslt to provide redirects with specific status codes. This too can be used against the 404 page, and allows you to do your own parsing methods to find the destination page, and redirect.
URL Rewrites can do the same effect, but of course it is not easily customized by end users or other scripts (events to log moves/name changes, etc). Any chance of a sneak peak? :-) DC
|
|
 Rank: Devotee
Joined: 7/24/2008 Posts: 50 Location: Crewe, UK
|
I've managed to sort it with a fairly simple user control as disussed in this thread. HTTP Status Codes
|
|
|
Guest |