Jump to content
Latest News: (loading..)
Sign in to follow this  
adz1976

302 Redirect when searching for Products

Recommended Posts

Hi

I am having an issue with my searchbox in the header.

 

When I search for products, I get a 302 redirect but this doesn't happen every time. average : 3 out of 10 times

Example:

I search for a drill & I get the following log:

302  -  GET /advanced_search_result.php?keywords=drill&osCsid=2t04n06p7j33t897nb6e0bde45 HTTP/1.1


I search for the drill again, and then it works with the following log.

200  -  GET /advanced_search_result.php?keywords=drill HTTP/1.1

 

The issue seems to be the following but totally baffled to why it is adding the  osCsid=  to the end of the search ?  -  &osCsid=2t04n06p7j33t897nb6e0bde45

 

Any ideas would be greatly appreciated


Many thanks


Adam

 

 

 

 

Share this post


Link to post
Share on other sites

A 302 status is "temporarily moved". It usually means that somewhere there is a URL redirect (new protocol and/or domain, requiring an extra round trip to the browser) that does not explicitly give a status code (e.g., [R=301,L] for a "permanently moved"). 302 is the default. If you're doing something like a redirect to add or remove www. on your domain, or force https (SSL), make sure you explicitly give a 301 code (assuming it's permanent). Also check your configure.php files that you're giving the correct form of the protocol and domain, and not relying on an extra round trip to convert it to the desired form. If that doesn't fix it, the discussion will have to go deeper.


If you are running the "official" osC 2.3.4 or 2.3.4.1 download, your installation is obsolete! Get the latest community-supported responsive "Edge" release

Share this post


Link to post
Share on other sites

Hi Phil

Thanks for replying so quickly

Below are my settings in configure and .htaccess - Nothing about 302 redirect in .htaccess 

configure.php

define('HTTP_SERVER', 'http://www.macbuildingproducts.com');
  define('HTTPS_SERVER', 'https://www.macbuildingproducts.com');
  define('ENABLE_SSL', true);

.htaccess

RewriteRule ^(.*)$ https://www.macbuildingproducts.com/$1 [R=301,L]
 

I'm now thinking the 302 redirect is only happening because of the osCsid= being added at the end of the search result.
So the 302 is actually doing what it's meant to do.


Do you know why the osCsid is being added to the search result ?

&osCsid=2t04n06p7j33t897nb6e0bde45

Search for DRILL

/advanced_search_result.php?keywords=drill HTTP/1.1 (WORKS PERFECTLY AND LISTS RESULTS)

Search for DRILL another time and this happens

/advanced_search_result.php?keywords=drill&osCsid=2t04n06p7j33t897nb6e0bde45 HTTP/1.1 (GOES TO INDEX PAGE WITH REDIRECT 302)


It doesn't happen all the time, its intermittent. 

I don't know where osCsid= is being pulled from and why it's being added in the search result now and again ?

 

Hope I've explained this clearly enough

 

Many thanks

Adam

 

Share this post


Link to post
Share on other sites

Do you have any other rewrite rules or similar function commands in any of your .htaccess files? Anything that doesn't give an explicit 301, or involves rewriting the protocol and/or domain without an explicit 301? I vaguely recall seeing something about unexpected osCid being added to a URL when generating a link, so be sure to search this forum for it. I suspect that they are two separate problems, but I can't be sure. Has anything changed lately, such as PHP or server version, that might be handling session variables differently? By the way, what osC version and what PHP version are you running? Anything earlier than the current osC 2.3.4.1BS Edge/CE/Frozen is going to give you problems on up-to-date PHP versions (5.6 or higher).


If you are running the "official" osC 2.3.4 or 2.3.4.1 download, your installation is obsolete! Get the latest community-supported responsive "Edge" release

Share this post


Link to post
Share on other sites
Posted (edited)
On 7/12/2018 at 6:21 PM, MrPhil said:

Do you have any other rewrite rules or similar function commands in any of your .htaccess files? Anything that doesn't give an explicit 301, or involves rewriting the protocol and/or domain without an explicit 301? I vaguely recall seeing something about unexpected osCid being added to a URL when generating a link, so be sure to search this forum for it. I suspect that they are two separate problems, but I can't be sure. Has anything changed lately, such as PHP or server version, that might be handling session variables differently? By the way, what osC version and what PHP version are you running? Anything earlier than the current osC 2.3.4.1BS Edge/CE/Frozen is going to give you problems on up-to-date PHP versions (5.6 or higher).

Hi Phil

After doing a search on what you suggested "unexpected osCid being added to a URL when generating a link" I came across some issues with Forced Cookies with SSL.

As I have a SSL site, I did a few tests and turned off Forced Cookies and to my amazement.....it's worked!! 

Still not sure why this would add Oscsid= but since I turned it off, I have done more than 100 searches in different Browsers and works every time.

Thanks for all your help in sending me on the right path.


Perfect result  :)


Also, I forgot to answer your question.

Yes, I upgraded a few Months ago from MS2.2 to V2.3.4 running PHP5.6.36 but only just realized the search was not working properly.
 

Many thanks again


Adam

 

Edited by adz1976

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×