Jump to content


Photo

PHP redirect Help


  • Please log in to reply
2 replies to this topic

#1 davidlenehan

davidlenehan
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 10 March 2006 - 11:05 AM

Hi,

I have a quick query, Im new to PHP, I was wondering if someone could help me with this problem. I need to place some PHP in the head include file on my website. And I need to to check the following:

If the current page url is:

[a href=\"http://www.rrr.com/news/130/\" target=\"_blank\"]http://www.rrr.com/news/130/[/a]

then redirect to:

[a href=\"http://www.rrr.com/sss.php\" target=\"_blank\"]http://www.rrr.com/sss.php[/a]

How can I check the url?

thank you
DAvid.


#2 craygo

craygo
  • Staff Alumni
  • Advanced Member
  • 1,973 posts
  • LocationRhode Island

Posted 10 March 2006 - 04:37 PM

Well you can put togetter a couple variables to find out where you are at

$site = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'].'';

That will give you the address you are currently at. Then use an if then statement to redirect

Ray

#3 davidlenehan

davidlenehan
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 10 March 2006 - 04:39 PM

[!--quoteo(post=353652:date=Mar 10 2006, 04:37 PM:name=craygo)--][div class=\'quotetop\']QUOTE(craygo @ Mar 10 2006, 04:37 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
Well you can put togetter a couple variables to find out where you are at

$site = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'].'';

That will give you the address you are currently at. Then use an if then statement to redirect

Ray
[/quote]

cheers ray!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users