How to redirect blog.mydomain.com to mydomain.com/blog?

Discussion in 'Getting started' started by robertt, Jul 27, 2010.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. I use the following code for redirection
    Code:
            
    string strServerName = (Request.ServerVariables["SERVER_NAME"]);
    
            if (strServerName.Trim().ToLower() == "testapp.mydomain.com")
                Response.Redirect(@"/testapp"); 
    
    Unfortunately this code redirects to url testapp.mydomain.com/testapp
    which screws up my MVC application. How should I change redirection, so that url will be testapp.mydomain.com?
     
  2. Bruce

    Bruce DiscountASP.NET Staff

    change this

    Response.Redirect(@"/testapp");

    to

    Response.Redirect("http://mydomain.com/blog")
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page