redirect at an instant!!

Okay this is fairly hard (I think).
I have two URL's, basically and, and I have noticed some sites (Altavista and this one) redirect striaght away form one to the other without displaying an inbetween page. How is this done?

I have asked else where but was told it was vagely to do with thttpd and 301 codes!!
Can anyone shed some light on this?
Who is Participating?
jhurstConnect With a Mentor Commented:
As you have discovered, you can do it with <meta refresh> but this causes exactly the problem that you need to load the page with the <meta > in order for the browser to get it.

You are also correct that the 301 is the correcr method and this can not be done with html.

However, most web servers allow you to send this 301 response in a manner by sepcifying a Location-header line.

So, for example, at make an index.cgi rather than a more typical index.html.  This index.cgi will contain the code to generate the header that you need.  

In perl:
print "Location:\n\n";

or as a shell script
echo "Location:"
echo ""

or in C...., etc.

Now, the web server sees the Location and realizes that it needs to send a 301 response (page moved) and sends the actual address as the new location.  This header arrives at the browser, instead of a page and causes it to request the new address.

Technically the first address is visited since it is the one that sends the re-location but you will not see this.  

So, if performance is the issue then you would be better to get your hosting company to set them to the same area.

SRPAuthor Commented:
I have also asked my web host, they claim not to deal with it and have no idea how to do it anyway!
Has anyone suggested a meta-refresh?

Make a default page for whichever domain you do NOT want to visit.  In the header for that page put:

<meta http-equiv="refresh" content="0; URL=domainyouwanttogoto/indexpage">

I think that will do what you are wanting.

In an IIS/ASP ballpark this can be done with "response.redirect".

Never miss a deadline with

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

To explain a little more fully, the meta tag tells the browser to load a new page.  The content tells the browser how long to wait (in seconds) before requesting the new page, and the URL tells it the new page to request.

Hope this helps,

Or, you can ask the DNS administrator to edit the DNS table to redirect before it even gets to the Web server, essentially it enables the DNS to send every request for to  This is a one time deal and will work irregardless of the web server pages or content.


If the DNS admin is working with the hosting service, it does not look like this is going to be a happy option.

Additionally, various web servers will allow "aliasing", or "virtual domains" where you change the name displayed on the location line.

Basically you can define the web site that lives in:

to be displayed as:

pretty simple...
SRPAuthor Commented:
Looks like a nice solution but I haven't managed to get it working. The page changes constantly, forever(!) never actually getting to the other URL. Do I need any thing else in the code or within the head or body tags?
Also will this work with any browser?
SRPAuthor Commented:
Sorry, my mistake I think it will work now, I mistyped the URL entry by inclosing it in " ", instead of inclosing the "0; URL=..."

Thanks very much

However will it work in all browsers?
SRPAuthor Commented:
I have just heard from another source that the meta tag you suggested is a bad idea because it is not user friendly and you can't back through it, which is slightly annoying.

Are there any other methods?

Does anyone no about using 'thttpd' as an option, I have no idea how it works but it was suggested as an alternative.
A lot of places offer to park a second domain on the same IP as your first domain.

Sometimes the cost is as little as $25 depending on your service.

But it's not a shaky deal that you have to talk them into.

It should be a legitimate service that they offer.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.