Jump to content

Recommended Posts

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

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");

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.

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.

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.

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

 

 

 

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."

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

 

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.

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.