PHP help (General Discussion)

PHP help // General Discussion

1  |  

butterfly jess

Feb 26, 2002, 10:45pm
This isn't the best place to ask, but I'm trying to redirect all traffic
using the ISP splitrock.net to www.test.com
Using that ISP, I cannot get myself redirected. I've also tried it with an
IP address instead of a host.

The code has to be short because it will be appended to EVERY document on my
server.
The code is below.

$Redirect_Page="http://test.com";
if(ereg("splitrock.net$","$REMOTE_ADDR||$REMOTE_HOST")){header("location
: $Redirect_Page");}

ananas

Feb 27, 2002, 4:05am
Did you try the same with a / behind test.com ?

If you don't have it there, you redirect to an address that is a redirect itself.

The second thing that might be missing are 2 CR's behind the redirect command :

$Redirect_Page="http://test.com/";
if(ereg("splitrock.net$","$REMOTE_ADDR||$REMOTE_HOST"))
header("location : $Redirect_Page\n\n");


[View Quote] --
"_
|
/\
\ /
__/ /_

ananas

Feb 27, 2002, 4:13am
sorry, one more :

I don't think that your regular expression can work like this.
The "...t$" requires a request string that ends with the "t".
Did you print out the actual strings?

Maybe $HTTP_HOST would be a better string to check, and there
the faster "strcmp" would be sufficient to do the compare.

Use a phpinfo(); to see which string matches your requirements
better than those you use.

[View Quote] --
"_
|
/\
\ /
__/ /_

wizard myrddin

Feb 27, 2002, 12:30pm
If you are just trying to perform a redirect on page load the simplelest way
is to do a refresh and re directect from any page. This is done in the
metatags as such;

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="refresh" content="1">
<meta http-equiv="refresh" content="1;URL=http://www.test.com">

This html should be placed in the head part of your page and after 1 sec
will redirect to www.test.com

Just place on any page


Wiz


[View Quote]

1  |  
Awportals.com is a privately held community resource website dedicated to Active Worlds.
Copyright (c) Mark Randall 2006 - 2024. All Rights Reserved.
Awportals.com   ·   ProLibraries Live   ·   Twitter   ·   LinkedIn