IIS 6 - How to show page telling user they are being redirected to the new domain name, and then redirecting them with their full path

Posted on 2007-10-18
Last Modified: 2013-12-13
We have changed the domain name of our server.  When the users still try to go to our old domain name (i currently have this old name assigned to a second ip address on that same server), I want to display a page to them telling them that the domain name has changed (please update your bookmarks...) and then I want to redirect them to the new domain name, but I also want to carry over their full path that they typed in the url (since the directory and file structure is still identical).  How can I do this??  For the full path, this also includes carrying over whether they requested http or https in their url.  Thank you!!
Question by:sah18
    LVL 18

    Accepted Solution

    u can use javascript to do so.

    Modify the landing page (index.html or default.htm etc.)

    First at the page load start a timer and show the user a text that the new Domain is blablabla.
    Then after the timer gets it time complete, redirect user to an aspx page (lets redirect.aspx).
    Get the URL of the current page in the serverside code of redirect.aspx
    u can get the current url from the following urls

    now u have file name also, then redirect user to that page with new server address.
    LVL 13

    Assisted Solution

    HTTP has response codes to tell the user that content has moved just for this type of problem. Its clean neat and it will also instruct web spiders to go and crawl your new site. By using Javascript you annoy the hell out of people who dont have it turned on or dont support it ( such as mobile browsers ).

    In the Apache world this is done by url rewrites and you would use a 301 code to tell the browser that page has moved perminartly to here and the browser will redirect for you. In the IIS I beleave you can use IISRewrite which adds the functionality as Microsoft are slack.
    LVL 12

    Expert Comment

    i think you can do this very easily, change the landing page to say the message what you want to.... then add the below line in this page, anywhere you want.

    <meta http-equiv="refresh" content="5;url=">

    change 5 to anything you want, number of seconds. So the users will see this page for that many seconds and will be directed to the new site.

    I hope this helps!
    LVL 13

    Expert Comment

    Meta Reresh would do it however it wouldent keep the original path ( ie if you went to you would want it to direct you to ditto for http https.

    Ive dont this in PHP and Paache but must admit ive not got round to properly looking at ASP but you could do it this way if you write a catch all ASP page and manually change the values in the meta tag.

    Featured Post

    Live: Real-Time Solutions, Start Here

    Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

    Join & Write a Comment

    If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that undeā€¦
    The viewer will learn how to dynamically set the form action using jQuery.
    This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now