I'm thinking of switching my cloud provider from AppHarbor to Azure. Main reason, I love the ability of being able to scale up the number of workers as traffic/cpu usage gets really high.

My question is, how to coordinate this transition for users that still point to *.apphb.com instead of www.{mycustomdomain}.com.

I saw in a "SEO Friendly URLs" blog post that the proper response code when navigating to old URL paths is to do:

return RedirectToActionPermanent("{actionname}", "{controllername}", new { int? param1, string param1 } );

Where the "Permanent" is added. I guess it returns a 301 instead of a 302 which tells google-bot crawlers to permanently redirect their mappings/indexes to the new URL.

So, in my code, do I add a line that checks to see what URL is processing the request (this is assuming that I leave the app harbor site running, but without the custom domain pointing to it), and if it's app harbor, then issue a 301 to the corresponding crawler to go to the new URL, but how to notify the "human" user?

Is there a better way to do this?

1 Answer 1


You could use the simple meta refresh method - http://en.wikipedia.org/wiki/Meta_refresh

Or you can use as you have stated a 302 Redirect - http://en.wikipedia.org/wiki/HTTP_302

With the 302, you can perform this in your server side code, or if the AppHarbour web server allows, you can configure it to perform this task.

As for performing different tasks depending on whether it is a bot or a human loading the page. You can do this with your server side code by looking at the GET request header, where is will identify its self with HTTP_USER_AGENT header.

  • Does it make sense to just create a custom actionfilter that does a redirect? That way, all the current code can stay except for a change in just two places. Then any page, no matter which is called, will get redirected to the correct website.
    – ganders
    Oct 28, 2014 at 12:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.