[SOLVED] URL redirection script? or ???

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
justjoe
Forum Newbie
Posts: 2
Joined: Sat Jun 12, 2004 5:50 am

URL redirection script? or ???

Post by justjoe »

I hope I am posting in the appropriate forum. If not, please correct me.

I run a small hosting business using an EV!Servers box (Linux, Red Hat, Ensim CP).

A client owns two domain names. Let's call them:

sampleONE.com
sampleTWO.com

The client wants vistors who call for sampleONE.com to be directed to the web site at sampleTWO.com. An important element is that this should be done transparently, with minimal delay and the browser URL field should show the URL as sampleTWO.com.

I suspect this could be with a PHP script installed on the index page of sampleONE.com and I'm hoping someone can suggest one.

Advice please?
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

See php-manual, examples for [php_man]header[/php_man].
justjoe
Forum Newbie
Posts: 2
Joined: Sat Jun 12, 2004 5:50 am

Post by justjoe »

Thank you for your response.

I just went throiugh the entire section of the PHP Manual on Headers, every last word. I did not find anything there that seemed to address my question. If it did, it's couched in terms of some other issue that does not appear, to me, to be relevant.

Does anyone else have any other suggestions?

And, to the moderator, please do not mark the question solved. It may be for you but it's not for me and I think that's the point of a forum.
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

Code: Select all

header("Location: http://www.php.net/header");
Exampe 4 in the php manual's chapter on header. You could also search this forum for "redirect".

P.S.: Moved to PHP Code
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

It could be done with mod_rewrite:

Code: Select all

RewriteEngine On
RewriteRule ^/(.+) http://sampleTWO.com/$1 їR,L]
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

Sorry, my mind was too set on PHP. Thanks, Weirdan.
Post Reply