Magento 2, Magento Development, Customization, Extension Development and Integration, Optimization, SEO and Responsive Design

Magento 2, Magento Development, Customization, Extension Development and Integration, Optimization, SEO and Responsive Design

PHP Sessions Not working for all pages


If you are getting problem like your php session not working in all pages of your site, than don't worry here you can easily solve your problem if your problem match to my problem i have previously in my site and i solve.

So suppose in your login page you started your session as...

session_start();
$_SESSION['islogin'] = 'true';

but your 'islogin' session is not working for all the pages except few pages. Than may be there is problem in your url. Please check there is a 'www' in your url. If not than add 'www' in your url and try again. If you want to add 'www' in your url using htaccess file than try following.

RewriteEngine On
RewriteCond %{HTTP_HOST} ^[^.]+\.[^.]+$
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [L,R=301]

Add these three lines of code in your .htaccess file.

May be this changes solve your problem.

Please support us, Like us on Facebook.

0 comments:

Post a Comment

 

Copyright @ 2017 HKBlog.