|
|
 Rank: Newbie
Joined: 6/28/2008 Posts: 14 Location: The Netherlands
|
Hi,
We are using the property field umbracoUrlAlias to redirect urls from the old site to the new one. Example: Old site url: /news/this_is_the_title_of_an_article_in_the_old_site.aspx
New umbraco url: /news/new-article.aspx
In /news/new-article.aspx i have created a property umbracoUrlAlias with the value of "news/this_is_the_title_of_an_article_in_the_old_site" so the old url will go to the new page. Everything works fine except that it will return a http 200 status code on the old url but this must be an 301 redirect so we can prevent duplicatie content in Google. Any ideas to change the http statuscode returned by using the umbracoUrlAlias property? Thanks in advance!
|
|
 Rank: Umbracoholic
Joined: 9/8/2006 Posts: 1,831 Location: MA, USA
|
I'd have to check, but if you use the umbracoRedirect alias instead of umbracoUrlAlias I think you'll get the 301 response as well as the redirect. cheers, doug.
MVP 2007-2009 - Percipient Studios
|
|
 Rank: Addict
Joined: 7/19/2006 Posts: 815 Location: Århus, Denmark
|
But using the umbracoRedirect would demand that you create umbraco pages with the old url's which I am guessing you do not want to do? How many articles are we talking about? Would it be ok to make a manual list of the needed redirects in an xml file?
|
|
 Rank: Addict
Joined: 7/19/2006 Posts: 815 Location: Århus, Denmark
|
You could use the UrlRewriting.config file to manually edit a list urls to redirect, like this: Code: <add name="htmrewrite" virtualUrl="^~/news/this_is_the_title_of_an_article_in_the_old_site.aspx" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/news/new-article.aspx" redirectMode="Permanent" redirect="Application" ignoreCase="true" /> <add name="htmrewrite" virtualUrl="^~/news/this_is_the_title_of_an_article_in_the_old_site2.aspx" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/news/new-article2.aspx" redirectMode="Permanent" redirect="Application" ignoreCase="true" />
|
|
 Rank: Addict
Joined: 7/19/2006 Posts: 815 Location: Århus, Denmark
|
Alternatively you could place a usercontrol on your template, that checks if the current page has been fetched with the correct url, and if not, do a 301 redirect the the umbraco.library.NiceUrl() url.
|
|
 Rank: Umbracoholic
Joined: 9/8/2006 Posts: 1,831 Location: MA, USA
|
Good point, Morten! I wonder what happens if you have both umbracoUrlAlias and umbracoRedirect. Hmmm. Might work. Worth a quick test at least. Otherwise, you could use one of the various redirect packages from Casey or Soeren, for instance to handle the redirection aspect. Beyond that, I think Morten is right in asking about an xml file or urlRewriting or some other options. cheers, doug.
MVP 2007-2009 - Percipient Studios
|
|
 Rank: Newbie
Joined: 6/28/2008 Posts: 14 Location: The Netherlands
|
Hi guys,
Thank you for your quick reply's!
Mortenbock is right. I don't want to create the "old" pages in Umbraco. There are +/- 200 old url's i can add them manually in the UrlRewriting.config but i want to make the old url redirects easy editable because new documents (and urls) are added to the current system. I think when i use the umbracoUrlAlias and the umbracoRedirect on the same page it will always redirect with a 301, i only need a redirect when accessing the page by the old url defined in the umbracoUrlAlias property. Antoher side effect is that how do i automatically fill the umbracoRedirect property with the nodeid from the current page?
I think the option from mortenbock is the best option to define the property umbracoUrlAlias for each document type and create a usercontrol that checks if the current page has been fetched with the correct url, and if not, do a 301 redirect the the umbraco.library.NiceUrl() url.
The redirect packages are working the other way around, redirecting from a umbraco page to an internal of external url. So this is not an option i think.
|
|
|
Guest |