|
|
 Rank: Addict
Joined: 7/19/2006 Posts: 608 Location: Bad Homburg, Germany
|
I have published a small new package named TH.FollowUrl which enables you to redirect for renamed (or if you add the urls manually also for deleted) nodes. You can download it here. So what does this package do?In your umbraco installation it copies the TH.FollowUrl.dll to your bin folder and creates a new table named ThFollowUrl with columns (nodeID and Url). The functionality is as follows: In the dll there are two classes. On the one hand there is the PublishHandler with which you can automatically add the nice url of your nodes to the created table each time you publish a node. If you want to use the PublishHandler you have to add the key Code:<add key="TH.FollowUrl.UsePublishHandler" value="true" /> to your web.config. If you use "false" or leave the key the publish handler isn't used, but you can add the urls manually in the db. On the other hand there is the NotFoundHandler class which redirects to the new id if the requested url is in the table. To use the handler you have to add the key Code:<notFound assembly="TH.FollowUrl" type="NotFoundHandler"/> to the /config/404handlers.config. Why did I do this package?In my company are many editors who don't have a glue of websites and don't think about renaming sites. With my LogViewer I saw many, many NotFounds referred by other sites also by search engines. I know that it is bad practice to rename content. I also know that it would better to tell the search engines a permanently removed or new url message. But it would have taken too much time for me and in my comp there is no understanding for using more time. If someone wants to extend the package or has better ideas please give me your feedback. Thomas
• 2007/2008 MVP • www.thoehler.com • Bad Homburg, Germany
|
|
 Rank: Addict
Joined: 7/19/2006 Posts: 608 Location: Bad Homburg, Germany
|
Another try for the code preview: I have published a small new package named TH.FollowUrl which enables you to redirect for renamed (or if you add the urls manually also for deleted) nodes. You can download it here. So what does this package do?In your umbraco installation it copies the TH.FollowUrl.dll to your bin folder and creates a new table named ThFollowUrl with columns (nodeID and Url). The functionality is as follows: In the dll there are two classes. On the one hand there is the PublishHandler with which you can automatically add the nice url of your nodes to the created table each time you publish a node. If you want to use the PublishHandler you have to add the key Code:<add key="TH.FollowUrl.UsePublishHandler" value="true" /> to your web.config. If you use "false" or leave the key the publish handler isn't used, but you can add the urls manually in the db. On the other hand there is the NotFoundHandler class which redirects to the new id if the requested url is in the table. To use the handler you have to add the key Code:<notFound assembly="TH.FollowUrl" type="NotFoundHandler"/> to the /config/404handlers.config. Why did I do this package?In my company are many editors who don't have a glue of websites and don't think about renaming sites. With my LogViewer I saw many, many NotFounds referred by other sites also by search engines. I know that it is bad practice to rename content. I also know that it would better to tell the search engines a permanently removed or new url message. But it would have taken too much time for me and in my comp there is no understanding for using more time. If someone wants to extend the package or has better ideas please give me your feedback. Thomas
• 2007/2008 MVP • www.thoehler.com • Bad Homburg, Germany
|
|
 Rank: Addict
Joined: 7/19/2006 Posts: 608 Location: Bad Homburg, Germany
|
Last try with plain text: I have published a small new package named TH.FollowUrl which enables you to redirect for renamed (or if you add the urls manually also for deleted) nodes. You can download it here. So what does this package do?In your umbraco installation it copies the TH.FollowUrl.dll to your bin folder and creates a new table named ThFollowUrl with columns (nodeID and Url). The functionality is as follows: In the dll there are two classes. On the one hand there is the PublishHandler with which you can automatically add the nice url of your nodes to the created table each time you publish a node. If you want to use the PublishHandler you have to add the key <add key="TH.FollowUrl.UsePublishHandler" value="true" /> to your web.config. If you use "false" or leave the key the publish handler isn't used, but you can add the urls manually in the db. On the other hand there is the NotFoundHandler class which redirects to the new id if the requested url is in the table. To use the handler you have to add the key <notFound assembly="TH.FollowUrl" type="NotFoundHandler"/> to the /config/404handlers.config. Why did I do this package?In my company are many editors who don't have a glue of websites and don't think about renaming sites. With my LogViewer I saw many, many NotFounds referred by other sites also by search engines. I know that it is bad practice to rename content. I also know that it would better to tell the search engines a permanently removed or new url message. But it would have taken too much time for me and in my comp there is no understanding for using more time. If someone wants to extend the package or has better ideas please give me your feedback. Thomas
• 2007/2008 MVP • www.thoehler.com • Bad Homburg, Germany
|
|
 Rank: Addict
Joined: 2/19/2007 Posts: 819 Location: Belgium
|
Nice, will try this one out !
Umbraco tips and tricks: http://www.nibble.be - umbraco mvp 08/09 - certified level 1 & 2 professional
|
|
 Rank: Fanatic
Joined: 7/25/2006 Posts: 433 Location: Silkeborg, Denmark
|
Nice. What kind of redirect does it do? Which http status code does it use? A regular redirect, or a "permanently moved"? /SoerenS Brug for råd til hvordan du driver en god webshop? / Need advice on how to run an effective webshop?
|
|
 Rank: Addict
Joined: 7/19/2006 Posts: 608 Location: Bad Homburg, Germany
|
No, it uses the umbraco interface for not found sites (umbraco.interfaces.INotFoundHandler). So you can return (if wanted) the id of another node or the standard 404 site of umbraco (in /config/umbracoSettings.config). The https status messages are good for search engines which you can better do in another way: Using the search engines sitemap xml file syntax (don't know the exact name atm). So this package is mainly for the urls which are permanently linked on other sites and which are renamed or delted and where you don't have the possibility to inform the linking sites. e.g: I have renamed my "umbraco utilities" to "utilities for umbraco". In the books section of the umbraco documentation site there is a direct link to this url which now is broken. If I had the my FollowUrl running at renaming the site with the new url is found via the old url. Better is it to inform the other website admin, so I have made a log entry which says that there was an url not found which was redirected to the new id. Hope this makes it clear. Cheers, Thomas
• 2007/2008 MVP • www.thoehler.com • Bad Homburg, Germany
|
|
 Rank: Fanatic
Joined: 7/25/2006 Posts: 433 Location: Silkeborg, Denmark
|
I haven't explored ActionHandlers in Umbraco at all, but I'm wondering if you can't solve the problem of renamed nodes / urls in the following way: 1) Create a handler for when nodes are Saved or Moved (not published). The handler should check if the node has been renamed (thus located at a different url). If it has, then an entry in your FollowUrl should be saved with the old URL and the new URL / ID. 2) A NotFoundHandler should check the table and do a PermanentlyMoved redirect to the new URL / node. Or maybe that's the way your package works? :-) /SoerenS Brug for råd til hvordan du driver en god webshop? / Need advice on how to run an effective webshop?
|
|
 Rank: Addict
Joined: 7/19/2006 Posts: 608 Location: Bad Homburg, Germany
|
Nearly, but two remarks: 1.) The publish handler is neccessary because an url changes only if you publish the node. So I have to take this moment to get the "old" url. It is a forecast if you will rename the node in future. If you haven't renamed the node the handler won't get in action, cuase the site is found. If you rename this node and a request comes to the old url the correct node will be shown (with the old url in the browser). 2.) It isn't a real redirect. The old url will be shown in the browser, but the new content is shown. So it is a build in method from umbraco to use an own 404 site which I abused. And as I said before: It is better practice to tell other sites that this is a broken link (via 404 permanently removed or something for search engines and via email to the admins for hard linked sites. Thomas
• 2007/2008 MVP • www.thoehler.com • Bad Homburg, Germany
|
|
 Rank: Addict
Joined: 7/19/2006 Posts: 608 Location: Bad Homburg, Germany
|
Thomas Höhler wrote: 1.) The publish handler is necessary
BTW: The PublishHandler is only necessary if you want to have an automatism for the NotFoundHanlder. You can also disable the PublishHandler via the app key in the web.config and add only urls really needed via db insert. Thomas
• 2007/2008 MVP • www.thoehler.com • Bad Homburg, Germany
|
|
 Rank: Aficionado
Joined: 1/19/2008 Posts: 182 Location: Belgium
|
Hi Thomas, I can't download the package Dave
Converting a DotNetNuke site to Umbraco : Follow it here
|
|
 Rank: Addict
Joined: 7/19/2006 Posts: 608 Location: Bad Homburg, Germany
|
It's weired, i will look into it tonight... Thomas
• 2007/2008 MVP • www.thoehler.com • Bad Homburg, Germany
|
|
|
Guest |