Reputation: 181
I have designed a home page on my pc which can be accesses through localhost/Home. Here i enter a site name and it must take me to that site. I have used header("Location: url "); function in my code and it takes in the site name properly. But the problem is, any site i try to open, it takes me to "localhost/site" like if i enter www.google.com in the input, it takes me to localhost/www.google.com
Is there any way where i can exit local host and go to google.com on input? or is it not possible?
Upvotes: 1
Views: 610
Reputation: 44444
You would need to give the complete absolute URL, including the scheme. Example:
header('Location: http://www.google.com');
Otherwise, the client would treat the URL as relative one.
Upvotes: 1