I want to set restriction to access frontend for users that are not logged-in to admin panel (same browser or not). Means user who is not logged in admin panel should not access frontend and should be redirected maintenance page.

I think it's possible by IP Address by editing index.php.

  • If you want it for different brwosers, you should go with Princes solution ... otherwise my answer should also work.
    – sv3n
    Jun 6, 2017 at 16:49

3 Answers 3


Try below free extension which will fulfill your requirement.



These extensions have a facility to set admin access so if admin will be logged in he may access frontend, other users will be redirected to a maintenance page.

Hope it helps.


  • I tried first extension you suggest Jun 7, 2017 at 4:49

Please try this ... add a custom module with this code:


<?xml version="1.0" encoding="UTF-8"?>



class My_Module_Model_Test extends Mage_Core_Model_Observer
    public function checkAdminIsLoggedIn(Varien_Event_Observer $observer)
        if (!Mage::getSingleton('admin/session')->isLoggedIn()) {
            $page  = 'about-magento-demo-store'; 
            $controller = $observer->getControllerAction();
            $aliases = $controller->getRequest()->getAliases();
            if ($aliases['rewrite_request_path'] != $page) {
                $controller->getResponse()->setRedirect($controller->getRequest()->getBaseUrl() . '/' . $page);

Note: you have to create a new "CMS Page" and adjust following line for your URL key:

$page  = 'about-magento-demo-store'; 

You can also try this free extension: https://github.com/astorm/Magento_CrossAreaSessions


1) You have to create an empty maintenance.flag file and upload it to the root folder of your site. After that your web site will have some message like:The server is temporarily unable to service...

2) open the index.php file and add this code on line 47:

$allowed = array('',''); //list of IP that will have access to frontend

3) replace

if (file_exists($maintenanceFile)) {


if (file_exists($maintenanceFile) && !in_array($ip, $allowed)) {

Nb: You can edit the message maintenance displayed in errors/default/503.phtml

  • NO, I want to set restriction for access front-end who is not logged-in to admin panel Jun 6, 2017 at 13:06
  • You said in title Only logged in admin should access to the frontend
    – PЯINCƎ
    Jun 6, 2017 at 13:08
  • Yes,exactly. Your code is only for specific IP Address Which i know already. Jun 6, 2017 at 13:11
  • before it was logged in and now is not logged in ;)
    – PЯINCƎ
    Jun 6, 2017 at 13:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.