[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

php header redirect modifying the URL

Posted on 2012-09-03
8
Medium Priority
?
354 Views
Last Modified: 2012-09-04
Hello Experts,

I have the following code:

<?
header('Location:http://www.abc.com') ;
exit;
?>

Open in new window


However, when I access this script, this redirects to:

http//www.abc.com

ie it is missing off the ":"

Any ideas why this is occurring?

Thanks!
0
Comment
Question by:jagku
8 Comments
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 38361098
Is there any more to the code, or is that the complete script?

Please post the URL that illustrates the behavior, thanks.
0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 38361108
I am unable to reproduce the behavior with this script.

<?php // RAY_temp_jagku.php
error_reporting(E_ALL);
header('Location:http://www.abc.com');
exit;

Open in new window

0
 

Author Comment

by:jagku
ID: 38361127
Thanks Ray,

I literally have those 2 lines of text.
I added error_reporting(E_ALL);  but nothing appears on the screen and the browser is still trying to redirect to http://www.abc.com

I am using Firefox.

Thanks
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 60

Assisted Solution

by:Julian Hansen
Julian Hansen earned 200 total points
ID: 38361135
Try this (space between the first colon and http)
<?
header('Location: http://www.abc.com') ;
exit;
?>
                                  

Open in new window

0
 
LVL 111

Accepted Solution

by:
Ray Paseur earned 1600 total points
ID: 38361189
trying to redirect to http://www.abc.com
These appear to be different URLs:

http://www.abc.com
http//www.abc.com

Without the protocol followed by the colon?  Please explain a little more about what seems to be wrong.  I tested the script that I posted above, and it worked correctly.  At www.abc.com there is a redirect to abc.go.com -- but that part of things is not under our control.
0
 
LVL 15

Assisted Solution

by:Jagadishwor Dulal
Jagadishwor Dulal earned 200 total points
ID: 38362553
One :

<?php
header('Location: http://www.abc.com/');
?>

Open in new window


Second Alternative:
<meta http-equiv="refresh" content="o;url=http://www.abc.com/"> 

Open in new window

0
 

Author Comment

by:jagku
ID: 38363370
Thanks for the above suggestions.
I will try them all out later on tomorrow.

Note: www.abc.com is just an example. It happens to any domain.
I'll post what has cracked the problem.

Thanks!
0
 

Author Closing Comment

by:jagku
ID: 38364270
Hi,

Ok, I worked out what the problem was - for some reason I was redirecting to

http://http:// 

Schoolboy error.

Nevertherless, thank you for your help - I have awarded everyone that helped some points.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses
Course of the Month18 days, 16 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question