Strange issue in header location redirect

Posted by hd01 on Server Fault See other posts from Server Fault or by hd01
Published on 2012-10-09T07:28:06Z Indexed on 2012/10/09 9:40 UTC
Read the original article Hit count: 210

Filed under:
|

I have three websites hosted (example1.com, example2.com, example3.com) on a server. There is a page (test.php) on example1.com with just code below inside it:

<?php
  header('Location:http://example2.com/a.php');
?>

When I browse test.php it goes to http://example1.com/a.php . it doesn't understand it is another domain url, it tried to find the page on itself.

but when I put http://google.com instead of example2.com/a.php it works correct. I really get confused.

What is the problem ? Should I set some configuration on the server?

( I am administrator of the hosting server ). Ps. The server is behind a pound server.

Here's the Firebug Net output for example1.com/test.php

Response Headers: 

HTTP/1.1 302 Found
Date: Tue, 09 Oct 2012 09:03:34 GMT
Server: Apache/2.2.16 (Debian)
Location: http://example1.com/a.php
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 21
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=utf-8

Request Headers:

Accept  text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding gzip, deflate
Accept-Language en-us,en;q=0.5
Connection  keep-alive
Cookie  mycookie
Host    example1.com
User-Agent  Mozilla/5.0 (X11; Linux i686; rv:14.0) Gecko/20100101 Firefox/14.0.1

© Server Fault or respective owner

Related posts about apache2

Related posts about redirect