Redirect from page in old domain to page in new domain
Hi,
Is it possible to add redirects from a page in an old domain to a page in a new domain where Umbraco will be hosted on?
For example if there is a page such as www.someolddomain.com/somepage.php and i want it to redirect to a page in our new site such as www.ournewdomain.com/ournewpage/ , how do i go about doing this? From playing around with this tool, it seems like it only does redirects for pages within the same domain of the site. Unless I'm missing something?
If the 301 URL Tracker cannot do this, then how can I achieve this with Umbraco? I know I can do this by adding custom redirects in the UrlRewriting.config file, but this poses a problem in that it doesnt work with old URLs that have query strings, and also I was hoping there would be a way to administer this through the Umbraco interface.
Not sure this is a lot of use but recently we coded up a HTTP module which compared the request URL to a dictionary of 301's (held in DB and cached on app start), if the request url matched we sent down a 301 and ended the processing for that request.
Nothing to do with Umbraco it was a pure .NET thing, but it sure helped the client deal with the migration from an old .html website.
I don't have the full code available right now (I'll try and post it for you tomorrow) but it should work regardless of the domain, but as the code works now it wouldn't redirect from one domain to another, just from yourdomain.com/oldfolder/oldpage.php to yourdomain.com/newumbracopage. It should be quite easy to modify the code to switch/replace the old domain with the new domain.
Right ok. When we go live we will be binding the old domains to the new website in IIS so that shouldnt be a problem. So if my old page was www.someolddomain.com/somepage.php and I'd like it to redirect to a new page I have created in Umbraco on our new site and domain, what value should I put in the custom mapping field for that Node? Should it just be /somepage.php without the www.someolddomain.com?
Yes, it should only be 'somepage.php' or '/somepage.php' (leading slash gets added automatically). And if it's a multi-website umbraco installation, the 301 URL Tracker will 'listen' to the domains set on the root nodes ("Manage hostnames")
One last very important thing, you'll have to find a way to map '*.php' url's to the .NET handler (ISAPI). I haven't done that before and can't find a blog- or forumpost which describes how to do this...
The 301 URL Tracker would probably work for "*.php" if you have a wildcard mapping to the .NET handler then? I always use the wildcard mapping since I want directory URLs instead of ".aspx" in Umbraco.
As for my code, I made a custom 404-page (IIS setting) and put that code to run in Page_Init().
I don't know, I tried a bit yesterday. I had a mapping for *.php to .NET, which was working. But the request still doesn't hit umbraco, I don't know why...
Redirect from page in old domain to page in new domain
Hi,
Is it possible to add redirects from a page in an old domain to a page in a new domain where Umbraco will be hosted on?
For example if there is a page such as www.someolddomain.com/somepage.php and i want it to redirect to a page in our new site such as www.ournewdomain.com/ournewpage/ , how do i go about doing this? From playing around with this tool, it seems like it only does redirects for pages within the same domain of the site. Unless I'm missing something?
If the 301 URL Tracker cannot do this, then how can I achieve this with Umbraco? I know I can do this by adding custom redirects in the UrlRewriting.config file, but this poses a problem in that it doesnt work with old URLs that have query strings, and also I was hoping there would be a way to administer this through the Umbraco interface.
Any help much appreciated,
Thanks.
Not sure if this is the best way, but I made a custom 404 like this:
So all you then need is to fill in the old relate path/Url in the new pages umbracoUrlAlias-property.
Regards,
Magnus
Thanks Magnus, it looks good. Where do I need to put this piece of code to make it work? Also will this work for pages on an old domain name?
Not sure this is a lot of use but recently we coded up a HTTP module which compared the request URL to a dictionary of 301's (held in DB and cached on app start), if the request url matched we sent down a 301 and ended the processing for that request.
Nothing to do with Umbraco it was a pure .NET thing, but it sure helped the client deal with the migration from an old .html website.
Chris.
I don't have the full code available right now (I'll try and post it for you tomorrow) but it should work regardless of the domain, but as the code works now it wouldn't redirect from one domain to another, just from yourdomain.com/oldfolder/oldpage.php to yourdomain.com/newumbracopage. It should be quite easy to modify the code to switch/replace the old domain with the new domain.
Regards,
Magnus
The 301 URL Tracker only supports redirects for the domains bound to the website in IIS.
Right ok. When we go live we will be binding the old domains to the new website in IIS so that shouldnt be a problem. So if my old page was www.someolddomain.com/somepage.php and I'd like it to redirect to a new page I have created in Umbraco on our new site and domain, what value should I put in the custom mapping field for that Node? Should it just be /somepage.php without the www.someolddomain.com?
Yes, it should only be 'somepage.php' or '/somepage.php' (leading slash gets added automatically).
And if it's a multi-website umbraco installation, the 301 URL Tracker will 'listen' to the domains set on the root nodes ("Manage hostnames")
One last very important thing, you'll have to find a way to map '*.php' url's to the .NET handler (ISAPI). I haven't done that before and can't find a blog- or forumpost which describes how to do this...
The 301 URL Tracker would probably work for "*.php" if you have a wildcard mapping to the .NET handler then? I always use the wildcard mapping since I want directory URLs instead of ".aspx" in Umbraco.
As for my code, I made a custom 404-page (IIS setting) and put that code to run in Page_Init().
Regards,
Magnus
I don't know, I tried a bit yesterday. I had a mapping for *.php to .NET, which was working. But the request still doesn't hit umbraco, I don't know why...
Doug Mackay had a great suggestion in another topic, will work with .asp too I think:
I've been investigating the issue of getting it to work with .php/.cfm pages :-
I belive that the umbraco 404 handlers only work with .aspx or extensionless url's (this is hard coded into the umbraco requestModule).
As a workaround you can set-up the UrlRewritter to rewrite .php requests to a .aspx page that does't exist :-
This then enables you to use the custom mapping in the 301 URL Tracker
e.g.
Custom mappings :-
/php/oldpage.aspx
/php/olddir/oldpage.aspx
So /oldpage.php or /olddir/oldpage.php will get 301 redirected to the umbraco page that you've set the custom mapping on.
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.