PHP Url redirect problem

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
ravo
Forum Newbie
Posts: 3
Joined: Sun Jul 27, 2008 8:03 am

PHP Url redirect problem

Post by ravo »

Hi all,
The problem im facing is-
say I have a site hosted at - http://www.abc.com/one/myApp
now in one of the html page in my application has url pointing to external address for eg. http://www.google.com. So now when i click on that url, i am suppose to be redirected to google page. But this is not happening. Instead its redirecting to http://www.abc.com/one/www.google.com. So here my redirect is failing. I tried putting a redir.php with
header(locaton:"www.google.com") code. but it also failed.

Please help me how to fix this url redirecting issue.

Thanks,
Ravi
User avatar
Pazuzu156
Forum Contributor
Posts: 241
Joined: Sat Nov 20, 2010 9:00 pm
Location: GA, USA
Contact:

Re: PHP Url redirect problem

Post by Pazuzu156 »

Thats simple, anytime you are connecting to another address, "http://" is always required, or else it will say that the link you click is on your website. so fix www.google.com to http://www.google.com/ and that should fix your problem
- Kaleb Klein
------------------------------------
Web Developer | Software Developer
https://kalebklein.com
PGP Key: https://keybase.io/pazuzu156
Post Reply