how this works (redirection??)

This is a discussion on how this works (redirection??) within the Apache Web Server forums, part of the Web Server and Related Forums category; Many times you go to a website, say xyz.org The moment it opens up in browser window, the address ...


Go Back   Usenet Forums > Web Server and Related Forums > Apache Web Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 08-10-2005
siliconmike
 
Posts: n/a
Default how this works (redirection??)

Many times you go to a website, say xyz.org
The moment it opens up in browser window, the address is changed to
www.xyz.com in the title bar.

Basically, how is this achieved ?

Am I looking at an apache configuration ?
Or is this an html trick ?

Mike

  #2 (permalink)  
Old 08-11-2005
Neredbojias
 
Posts: n/a
Default Re: how this works (redirection??)

With neither quill nor qualm, siliconmike quothed:

> Many times you go to a website, say xyz.org
> The moment it opens up in browser window, the address is changed to
> www.xyz.com in the title bar.
>
> Basically, how is this achieved ?
>
> Am I looking at an apache configuration ?
> Or is this an html trick ?


A simple redirect will (usually) do it:

<META HTTP-EQUIV="refresh" CONTENT="0;URL=http://my.newplace.com/">

--
Neredbojias
Contrary to popular belief, it is believable.
  #3 (permalink)  
Old 08-11-2005
Mark Parnell
 
Posts: n/a
Default Re: how this works (redirection??)

Previously in alt.html,alt.apache.configuration, siliconmike
<siliconmike@yahoo.com> said:

> Many times you go to a website, say xyz.org
> The moment it opens up in browser window, the address is changed to
> www.xyz.com in the title bar.


Please use example.com for example urls. That's what it's there for. :-)

> Basically, how is this achieved ?


Usually by sending a 301 (moved permanently) or 302 (found) HTTP status
code to the browser, pointing to the other site. Others in the 3xx
series could also be used, as appropriate.

> Am I looking at an apache configuration ?


Assuming your site is hosted with Apache, of course. ;-) Yes, it can be
done on the web server. It can also be done in a server-side scripting
language, such as PHP:

header('Location: http://www.example.com/');

> Or is this an html trick ?


It can (kind of) be done in HTML, as per Neredbojias' post, but is
better handled server-side.

--
Mark Parnell
http://www.clarkecomputers.com.au
alt.html FAQ :: http://html-faq.com/
  #4 (permalink)  
Old 08-11-2005
siliconmike
 
Posts: n/a
Default Re: how this works (redirection??)


Neredbojias wrote:
> With neither quill nor qualm, siliconmike quothed:
>
> > Many times you go to a website, say xyz.org
> > The moment it opens up in browser window, the address is changed to
> > www.xyz.com in the title bar.
> >
> > Basically, how is this achieved ?
> >
> > Am I looking at an apache configuration ?
> > Or is this an html trick ?

>
> A simple redirect will (usually) do it:
>
> <META HTTP-EQUIV="refresh" CONTENT="0;URL=http://my.newplace.com/">
>


this will cause first the oldplace.com to load
then newplace.com would load.

try yahoo.org - they take you to yahoo.com without double loading..

is this a dns trick or what?

Mike

  #5 (permalink)  
Old 08-11-2005
Leif K-Brooks
 
Posts: n/a
Default Re: how this works (redirection??)

siliconmike wrote:
> Many times you go to a website, say xyz.org
> The moment it opens up in browser window, the address is changed to
> www.xyz.com in the title bar.
>
> Basically, how is this achieved ?


You should really be doing the opposite, redirecting
http://www.example.com to http://example.com. The www subdomain is a
rather nasty hack which should have never been invented, and is
deprecated on the modern Web. See http://no-www.org/.
  #6 (permalink)  
Old 08-11-2005
siliconmike
 
Posts: n/a
Default Re: how this works (redirection??)


Mark Parnell wrote:

> header('Location: http://www.example.com/');
>


Works great.

  #7 (permalink)  
Old 08-11-2005
Mark Parnell
 
Posts: n/a
Default Re: how this works (redirection??)

Previously in alt.html,alt.apache.configuration, Leif K-Brooks
<eurleif@ecritters.biz> said:
> siliconmike wrote:
>> Many times you go to a website, say xyz.org
>> The moment it opens up in browser window, the address is changed to
>> www.xyz.com in the title bar.

>
> You should really be doing the opposite, redirecting
> http://www.example.com to http://example.com.


In the OP's example, we are talking about 2 different domains - one is
..org, the other .com.

> The www subdomain is a
> rather nasty hack which should have never been invented, and is
> deprecated on the modern Web.


No arguments there. The only time I type www in to access a site is if
I've already tried without the www and it didn't work.

> See http://no-www.org/.


I agree with their philosophy for the most part, but there are more
serious issues on that site that the presence or absence of www, like
javascript popup links, grey on white text that is really hard to read,
inappropriate link text...

--
Mark Parnell
http://www.clarkecomputers.com.au
alt.html FAQ :: http://html-faq.com/
  #8 (permalink)  
Old 08-11-2005
Jim Hayter
 
Posts: n/a
Default Re: how this works (redirection??)

On 10 Aug 2005 17:27:09 -0700, in alt.apache.configuration,
"siliconmike" <siliconmike@yahoo.com> wrote:

<snip>

>try yahoo.org - they take you to yahoo.com without double loading..
>
>is this a dns trick or what?
>
>Mike


It is done by sending a 301 status, generated by the web server:

08/11/05 10:21:45 Browsing http://yahoo.org
Fetching http://yahoo.org/ ...
GET / HTTP/1.1
Host: yahoo.org
Connection: close
User-Agent: Sam Spade 1.14

HTTP/1.1 301 Moved Permanently
Date: Thu, 11 Aug 2005 14:22:16 GMT
Location: http://www.yahoo.com/
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html; charset=iso-8859-1

The document has moved <A HREF="http://www.yahoo.com/">here</A>.<P>
<!-- p1.rc.scd.yahoo.com uncompressed/chunked Thu Aug 11 07:22:16 PDT
2005 -->


HTH,
Jim
  #9 (permalink)  
Old 08-11-2005
dingbat@codesmiths.com
 
Posts: n/a
Default Re: how this works (redirection??)

Neredbojias wrote:

> A simple redirect will (usually) do it:
> <META HTTP-EQUIV="refresh" ... >


Please don't do that.

  #10 (permalink)  
Old 08-12-2005
Neredbojias
 
Posts: n/a
Default Re: how this works (redirection??)

With neither quill nor qualm, dingbat@codesmiths.com quothed:

> Neredbojias wrote:
>
> > A simple redirect will (usually) do it:
> > <META HTTP-EQUIV="refresh" ... >

>
> Please don't do that.


Actually, I can't think of a valid reason for doing it.

--
Neredbojias
Contrary to popular belief, it is believable.
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 08:35 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0