skip to Main Content

Is their a way to put website frontend only in Maintenance mode, and allow all users to access admin. (i am working on PHP).

I believe that can be done via .htaccess, but not getting how ?

Any help ?

I tried :

RewriteEngine On
RewriteRule ^admin/.*$ - [F]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]

This does the reverse work, I am able to access frontend and not admin with this code.

Thanks.

3

Answers


  1. It is not possible to achieve this through .htaccess. At least not as a permanent solution. You could block access to edit pages but you will have to constantly edit .htaccess. Also you will have to make sure that you have all the paths right.

    Magento has a builtin function to block editing. If it doesn’t do what you want you should look into some magento plugins or create one yourself.

    Also your question is a too broad. You should provide at least an example of what you have tried and explain what doesn’t work.

    Login or Signup to reply.
  2. Any petition to an URL not containing ‘admin’ will redirect to index.php. Add some message “under maintenance” and you’re done:

    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !admin/
    RewriteRule . index.php [L]
    
    Login or Signup to reply.
  3. Try this solution. It will put in maintenance for clients but you can add users ips to access admin and fronted.

    Edit index.php add this lines:

    $ip = $_SERVER['REMOTE_ADDR'];
    
    $allowed = array('your ip','second ip', 'third ip');
    

    Change line

    if (file_exists($maintenanceFile)) {
    

    to

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

    Solution from:
    http://inchoo.net/magento/maintenance-mode-in-magento/

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search