I have a stranger behavior in my application, if open this url
http://example.com/Pd/Country/1
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}','CountryController@getAll');
});
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 example.com
and the next request done on http://www.example.com/
on which the sessions were not set .
The Solution
I had to change my .htaccess
file so that whether user type www.example.com
, example.com
or http://example.com/
will be changed to http://www.example.com/
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 ^ http://www.example.com%{REQUEST_URI} [R=301,L,NE]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With