Learn how to a build a cloud-first strategyRegister Now


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
Medium Priority
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
  • 2
LVL 18

Accepted Solution

Ajay Sharma earned 750 total points
ID: 20099982
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

rhickmott earned 750 total points
ID: 20107319
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 http://www.qwerksoft.com/products/iisrewrite/ which adds the functionality as Microsoft are slack.
LVL 12

Expert Comment

ID: 20108784
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=http://yournewsite.com">

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

ID: 20109545
Meta Reresh would do it however it wouldent keep the original path ( ie if you went to http://www.olddomain.com/page65.asp you would want it to direct you to http://www.newdomain.com/page65.asp 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to create an extensible mechanism for linked drop downs.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
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.
Suggested Courses

810 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