We use cookies to improve our services and provide a better experience. By continuing to use this site, you agree with our Cookies Policy.

Tutorials
More than 400 step-by-step articles to guide you through online project development.
HomeTutorialsCMS TutorialsJoomlaJoomla Administration

How to disable session handling for guest in Joomla 1.7

Ubuntu VPS
Germany Cloud Servers
cPanel KVM
OpenVZ VPS
KVM VPS
Windows Cloud Server
Linux Cloud Server
Linux KVM Hosting
Brazil VPS
USA VPS

If for some reason we need to disable session handling for guest in Joomla website, we might need to apply code modification. Since this procedure will require website code editing, basic programming knowledge is required in order to achieve any results.

Follow these steps to disable guest session handling

Start by connecting to the hosting server where Joomla website is hosted and open it’s public_html directory. This can be done by using any control panel like DirectAdmin, cPanel provided by hosting service or simple FTP client. There we will find all required files by browsing through Joomla directories. Firstly we will need to open file “index.php” for editing. It’s located in the public_html directory and should be visible instantly.

Joomla Index File

Open this file for editing by clicking “Edit” or download through FTP client to the local drive and edit it there. Then locate the following line

$app = JFactory::getApplication('site');

Replace the line above with the one below

1
$app = JFactory::getApplication('site',array('session'=>false));

Save the file and close it. Next open file “libraries/joomla/session/session.php” also for editing and locate the following line

1
protected function _start()

Replace it with the following code entry

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
protected function _start()
{
//check back-end url
$url = $_SERVER["REQUEST_URI"];
$pieces = explode("/", $url);
 
if(in_array ('administrator',$pieces) == true ){
 
// Start session if not started
if ($this->_state == 'restart') {
session_id($this->_createId());
} else {
$session_name = session_name();
if (!JRequest::getVar($session_name, false, 'COOKIE')) {
if (JRequest::getVar($session_name)) {
session_id(JRequest::getVar($session_name));
setcookie($session_name, '', time() - 3600);
}
}
}
 
session_cache_limiter('none');
session_start();
}
return true;
}

Again save and close the file which should be the final code modification. Now most importantly we need to ensure those modifications haven’t made any damage for the website. If everything went ok, session handling for guest in Joomla should be disabled.

USA VPS
Germany Cloud Servers
Windows Cloud Server
Ubuntu VPS
cPanel KVM
Linux KVM Hosting
KVM VPS
Linux Cloud Server
OpenVZ VPS
Brazil VPS
Rate this Tutorial:
No Comments Leave a Comment
Leave a Comment

Other (197)

Popular Keywords