redirect at an instant!!

Okay this is fairly hard (I think).
I have two URL's, basically mylittleempire.co.uk and
my-little-empire.co.uk, 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?
 
SRPAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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!
0
TTomCommented:
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".

Tom
0
TTomCommented:
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,

Tom
0
PMI ACP® Project Management

Prepare for the PMI Agile Certified Practitioner (PMI-ACP)® exam, which formally recognizes your knowledge of agile principles and your skill with agile techniques.

mgfranzCommented:
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 mylittleempire.co.uk to my-little-empire.co.uk.  This is a one time deal and will work irregardless of the web server pages or content.

Mark
0
TTomCommented:
Mark:

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

Tom
0
helverCommented:
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:

http://www.myisp.com/~myuser/george/

to be displayed as:

http://www.georgeyporgey.org/

pretty simple...
0
SRPAuthor Commented:
TTom
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?
0
SRPAuthor Commented:
TTom
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?
0
SRPAuthor Commented:
TTom
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.
0
jhurstCommented:
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 mylittleempire.co.uk 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:
#!/usr/bin/perl
print "Location: http://www.my-little-empire.co.uk\n\n";
exit;

or as a shell script
#!/bin/sh
echo "Location: http://www.my-little-empire.co.uk"
echo ""
exit

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.

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mayhewCommented:
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.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.