It probably makes sense that my first official blog post for my fresh start is on Orchard CMS since I currently spend a big portion of my day developing Orchard Websites, Orchard Modules, and Orchard Themes. This particular post is based on my own experience with the new Autoroute Part and Alias in Orchard 1.4 as well as a question I received from a client today. My client was changing the permalinks on published content items in his Orchard Website and noticed the website was still responding to the old permalinks. His question was fair - how do I remove the old permalinks from the Orchard Website?
How to Remove Old Permalinks from Orchard 1.4 Website?
In Orchard 1.4 the routing in an Orchard Website completely changed with the introduction of the Autoroute Part and Alias. The Alias connects the permalink to a controller and action in your Orchard Website. When you publish a content item in Orchard and then change the permalink of the content item after it is published, you get two Aliases in Orchard. One alias points the old permalink to the content item and the other alias points the new permalink to the content item.
This behavior isn't really what I would expect and most of my clients tend to agree. Rather than having two permalinks to the same content item I would expect that there is only the new permalink. When this happens I often get an email or phone call asking how to remove the old permalink.
If you look in the Orchard Dashboard under Modules you will find an Orchard Module called Alias UI. It allows you to add, edit, and delete the aliases in your Orchard Website. Enable Alias UI to remove the permalink.
Once you enable Alias UI there will be an Aliases Menu in the Orchard Dashboard. Choose Aliases and a list of all the aliases in your Orchard Website will be displayed. You will find two of them pointing to the same content item. Delete the old permalink. In the image below I temporarily changed the permalink to this blog post to indeed show you that you can get multiple aliases when changing the permalink on already published content.
It's a bit of a pain to do this, but I am not in the habit of changing permalinks once I have published content so I rarely do this.
HTTP 301 Moved Permanently Status Codes for Migrating Published Content
Originally, I had thought Orchard was keeping the old permalink around for SEO purposes and issuing an HTTP 301 Moved Permanently response to the browser with the new permalink. That could actually be a nice feature if you are changing permalinks that have been around for awhile. Unfortunately, Orchard is not doing this. It is just responding to both permalinks, which can actually be an SEO issue. SEO is out of the scope for this post, but I did just read a pretty good book on the subject - The Art of SEO.
If you are new to Orchard and having problems with duplicate permalinks, I hope this Orchard Tutorial helps. I do most of my blogging on Orchard CMS on Sarasota.me and DavidHayden.me, but since I work with it so much it is fair game for this website as well. I am available for hire if you are intereted in hiring an Orchard Web Developer.