[PHP] redirect based off server string

2005-08-10 Thread Robert Sossomon
Anyone have a script or know of a way to check and see what the url is of a
system and then sending it to another url if it is not right?

I have this problem where if someone is using:
http://www.ces.ncsu.edu/depts/fourh
instead of:
http://www.nc4h.org

to get to my site it is breaking other pieces within it (though there is code in
place which supposedly stops this from happening, I have found that this is not
the case)

what I plan on doing is invoking the script on the main page of each man
sub-directory and the main page so that it should catch the majority of folks.

Any suggestions/help would be greatly appreciated!

Robert

-- 
Robert Sossomon, Business and Technology Application Technician
4-H Youth Development Department
512 BrickHaven Drive Suite 220L, Campus Box 7606
N.C. State University
Raleigh NC 27695-7606
Phone: 919/515-8474
Fax:   919/515-7812
[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] redirect based off server string

2005-08-10 Thread Greg Schnippel
Try doing a pattern match on the server string and then using Header
to redirect them if its coming from the old server:

if (preg_match(/ces.ncsu/i, $_SERVER[HTTP_HOST])) {
 
 header(Location: http://www.nc4h.org;);

} 

- schnippy


On 8/10/05, Robert Sossomon [EMAIL PROTECTED] wrote:
 Anyone have a script or know of a way to check and see what the url is of a
 system and then sending it to another url if it is not right?
 
 I have this problem where if someone is using:
 http://www.ces.ncsu.edu/depts/fourh
 instead of:
 http://www.nc4h.org
 
 to get to my site it is breaking other pieces within it (though there is code 
 in
 place which supposedly stops this from happening, I have found that this is 
 not
 the case)
 
 what I plan on doing is invoking the script on the main page of each man
 sub-directory and the main page so that it should catch the majority of folks.
 
 Any suggestions/help would be greatly appreciated!
 
 Robert
 
 --
 Robert Sossomon, Business and Technology Application Technician
 4-H Youth Development Department
 512 BrickHaven Drive Suite 220L, Campus Box 7606
 N.C. State University
 Raleigh NC 27695-7606
 Phone: 919/515-8474
 Fax:   919/515-7812
 [EMAIL PROTECTED]
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] redirect based off server string

2005-08-10 Thread Leon Vismer
If you are using apache you can use the redirect module

VirtualHost 152.1.45.10
 Servername www.ces.ncsu.edu
 ServerAlias *
 Redirect permanent / http://www.nc4h.org/
 /VirtualHost

--
Leon

On Wednesday 10 August 2005 16:52, Robert Sossomon wrote:
 Anyone have a script or know of a way to check and see what the url is of a
 system and then sending it to another url if it is not right?

 I have this problem where if someone is using:
 http://www.ces.ncsu.edu/depts/fourh
 instead of:
 http://www.nc4h.org

 to get to my site it is breaking other pieces within it (though there is
 code in place which supposedly stops this from happening, I have found that
 this is not the case)

 what I plan on doing is invoking the script on the main page of each man
 sub-directory and the main page so that it should catch the majority of
 folks.

 Any suggestions/help would be greatly appreciated!

 Robert

 --
 Robert Sossomon, Business and Technology Application Technician
 4-H Youth Development Department
 512 BrickHaven Drive Suite 220L, Campus Box 7606
 N.C. State University
 Raleigh NC 27695-7606
 Phone: 919/515-8474
 Fax:   919/515-7812
 [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php