Laravel Return 302 In Some Machine - Browser

- 1 answer

I have a stranger behavior in my application, if open this url

In some machines and browser, I got the expected result and response code is 200 where other machines return 302

In my routes

Route::group(array('prefix' => 'Pd'), function() {
   Route::get('Country/{id}','[email protected]');

Updates I found out the problem is session not persisted in some machine and browser , I have got some suggestions to add Session::save(); after Session::push('keyvalue',$keyvalue );but still not working



The Real Problem

The url were different i.e: Sessions set on and the next request done on which the sessions were not set .

The Solution

I had to change my .htaccess file so that whether user type , or will be changed to

Options -MultiViews
RewriteEngine On

# remove index.php
RewriteCond %{THE_REQUEST} /index\.php [NC]
RewriteRule ^(.*?)index\.php$ /$1 [L,R=302,NC,NE]

RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC]
RewriteRule ^{REQUEST_URI} [R=301,L,NE]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]