SixPath Posted January 11, 2011 Share Posted January 11, 2011 does anyone here got an idea.. what make this message " This webpage has a redirect loop. The webpage at http://www.example.com/seek has resulted in too many redirects. Clearing your cookies for this site or allowing third-party cookies may fix the problem. If not, it is possibly a server configuration issue and not a problem with your computer." from the chrome browser. The header redirection for IE, FF AND SAFARI are working. define(SITE_URL,"http://www.example.com"); $cleanData = "search data"; $urlNow = SITE_URL."/quicksearch/".$cleanData; header("Location: ",$urlNow); *note im using mod_rewrite as RewriteRule ^quicksearch/(.*)$ searchResult.php?param=$1 [nc] thanks in advance.!!! Link to comment https://forums.phpfreaks.com/topic/224129-php-header-at-chrome-failed/ Share on other sites More sharing options...
trq Posted January 11, 2011 Share Posted January 11, 2011 You are passing a second argument to header, you shouldn't be. header("Location: $urlNow"); Link to comment https://forums.phpfreaks.com/topic/224129-php-header-at-chrome-failed/#findComment-1158114 Share on other sites More sharing options...
SixPath Posted January 11, 2011 Author Share Posted January 11, 2011 i tried this one.. but got the same result. header("Location: $urlNow"); I just wondering why is not working at chrome. Link to comment https://forums.phpfreaks.com/topic/224129-php-header-at-chrome-failed/#findComment-1158117 Share on other sites More sharing options...
johnny86 Posted January 11, 2011 Share Posted January 11, 2011 To the best of my knowledge Chrome won't forward without sending a status 200 OK with the header location. So do something like: header("Location: $url", true, 200); Link to comment https://forums.phpfreaks.com/topic/224129-php-header-at-chrome-failed/#findComment-1158118 Share on other sites More sharing options...
BlueSkyIS Posted January 11, 2011 Share Posted January 11, 2011 all my header()'s work fine in chrome using only location:. we need to see the code before the header() Link to comment https://forums.phpfreaks.com/topic/224129-php-header-at-chrome-failed/#findComment-1158121 Share on other sites More sharing options...
SixPath Posted January 11, 2011 Author Share Posted January 11, 2011 this is the code. this page accept post data include("secure/lib/config.php"); require(CLASS_SRC."class.dataCleaner.php"); $info = new dataCleaner(); $cleanData = $info->cleanData($_POST[param]); $urlNow = SITE_URL."/quicksearch/".$cleanData; header("Location: $urlNow"); Link to comment https://forums.phpfreaks.com/topic/224129-php-header-at-chrome-failed/#findComment-1158123 Share on other sites More sharing options...
BlueSkyIS Posted January 11, 2011 Share Posted January 11, 2011 so there is nothing before the include() and nothing after header()? do you have error_reporting turned on? if not, you can add this at the very top of the script: error_reporting(E_ALL); ini_set("display_errors", -1); you should also use exit() after the header, if there is no more processing to do. Link to comment https://forums.phpfreaks.com/topic/224129-php-header-at-chrome-failed/#findComment-1158126 Share on other sites More sharing options...
johnny86 Posted January 11, 2011 Share Posted January 11, 2011 I read a bit more and chrome does need the status header. Did you try to use header("Location: $url", true, 200); OR header("HTTP/1.1 200 OK"); header("Location: $url"); Link to comment https://forums.phpfreaks.com/topic/224129-php-header-at-chrome-failed/#findComment-1158127 Share on other sites More sharing options...
BlueSkyIS Posted January 11, 2011 Share Posted January 11, 2011 chrome does not need the status header when I write PHP code. try it yourself: http://www.blueskyis.com/test.php chrome is sent to www.cnn.com Link to comment https://forums.phpfreaks.com/topic/224129-php-header-at-chrome-failed/#findComment-1158128 Share on other sites More sharing options...
johnny86 Posted January 12, 2011 Share Posted January 12, 2011 It might depend on chrome version too? Because if the location works for IE, FF etc. isn't that a bit suspicious? Chrome headers are case-sensitive too, location: url will not work where as Location: url works. And there are a lot of people who have had problems with chrome too. Link to comment https://forums.phpfreaks.com/topic/224129-php-header-at-chrome-failed/#findComment-1158132 Share on other sites More sharing options...
SixPath Posted January 12, 2011 Author Share Posted January 12, 2011 yeah there is nothing more before the include() and after the header(). i will try to take this action.. and return here immediately. Link to comment https://forums.phpfreaks.com/topic/224129-php-header-at-chrome-failed/#findComment-1158133 Share on other sites More sharing options...
trq Posted January 12, 2011 Share Posted January 12, 2011 Sending a Location header via header() automatically sends a 302 redirect so adding a 200 OK is not only useless, but makes no sense. A 200 OK status will not redirect. Link to comment https://forums.phpfreaks.com/topic/224129-php-header-at-chrome-failed/#findComment-1158134 Share on other sites More sharing options...
BlueSkyIS Posted January 12, 2011 Share Posted January 12, 2011 it might be a lot of things, but i never have any problems using header() on any version of chrome. it is a very standards-compliant browser. we can hack around all day guessing what the code looks like and try to solve a problem that might be caused by the code that we can't see. or we can look at the code and proceed from there. Link to comment https://forums.phpfreaks.com/topic/224129-php-header-at-chrome-failed/#findComment-1158135 Share on other sites More sharing options...
SixPath Posted January 12, 2011 Author Share Posted January 12, 2011 i got this version > 8.0.552.224 as a chrome browser. Link to comment https://forums.phpfreaks.com/topic/224129-php-header-at-chrome-failed/#findComment-1158137 Share on other sites More sharing options...
trq Posted January 12, 2011 Share Posted January 12, 2011 Have you got error_reporting on as suggested by BlueSkyIS several posts ago? Link to comment https://forums.phpfreaks.com/topic/224129-php-header-at-chrome-failed/#findComment-1158141 Share on other sites More sharing options...
SixPath Posted January 12, 2011 Author Share Posted January 12, 2011 ok.. im using this settings in .htaccess #Force non-payment page into http format RewriteCond %{HTTPS} =on RewriteCond %{REQUEST_URI} !\/?(payment) [NC] RewriteRule .* http://%{SERVER_NAME}%{REQUEST_URI} [R,L] RewriteCond %{HTTPS} =off RewriteCond %{REQUEST_URI} ^\/?(payment) [NC] RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R,L] RewriteRule ^quicksearch/(.*)$ searchResult.php?param=$1 [nc] RewriteRule ^seek$ searchhere.php [nc] the later two lines are the line that coincides to my search feature. but i want to to show to you the http/https redirection on the upper part because.. everytime i try to make a search and got those message. i am dump on this url = "https://www.example.com/seek"; considering we got SSL certificate Link to comment https://forums.phpfreaks.com/topic/224129-php-header-at-chrome-failed/#findComment-1158147 Share on other sites More sharing options...
SixPath Posted January 12, 2011 Author Share Posted January 12, 2011 Have you got error_reporting on as suggested by BlueSkyIS several posts ago? from thorpe > no message at all. aside from this message "This webpage has a redirect loop. The webpage at https://www.example.com/seek has resulted in too many redirects. Clearing your cookies for this site or allowing third-party cookies may fix the problem. If not, it is possibly a server configuration issue and not a problem with your computer." Link to comment https://forums.phpfreaks.com/topic/224129-php-header-at-chrome-failed/#findComment-1158148 Share on other sites More sharing options...
butsags Posted January 12, 2011 Share Posted January 12, 2011 Are you set on using php? I've run into problems a few times while using multiple header() calls and needed a resort. Try javascript. window.location = "http://www.google.com/" you can attach it to a link: <a href="javascript:window.location = 'http://www.google.com/'">Go</a> or add this into the header tag and it will redirect automatically: <script type="text/javascript"> <!-- window.location = "http://www.google.com/" //--> </script> This should be more universal Link to comment https://forums.phpfreaks.com/topic/224129-php-header-at-chrome-failed/#findComment-1158196 Share on other sites More sharing options...
SixPath Posted January 12, 2011 Author Share Posted January 12, 2011 from butsags Are you set on using php? I've run into problems a few times while using multiple header() calls and needed a resort. Try javascript. Code: [select] window.location = "http://www.google.com/" you can attach it to a link: Code: [select] <a href="javascript:window.location = 'http://www.google.com/'">Go</a> or add this into the header tag and it will redirect automatically: Code: [select] <script type="text/javascript"> <!-- window.location = "http://www.google.com/" //--> </script> This should be more universal yeah i used that already, but js will work after the complete loading of page. and somehow.. we can see some white page before the redirection takes place. Link to comment https://forums.phpfreaks.com/topic/224129-php-header-at-chrome-failed/#findComment-1158313 Share on other sites More sharing options...
SixPath Posted January 13, 2011 Author Share Posted January 13, 2011 i guess this something to do in mod_rewrite of mine. I will solve this issue and back here later. Thanks for your wonderful insights. Guys. Link to comment https://forums.phpfreaks.com/topic/224129-php-header-at-chrome-failed/#findComment-1158939 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.