In our environment, we make changes to a drupal site that are then replicated to an outside webserver. We do not want people to be able to log into the drupal site from the outside. I want to remove whatever file /user and /admin resolves to but I can't find any information on this. In wordpress, you delete the wp-admin folder. Is there anything like this with Drupal? Turning off the "Allow login" setting will not work for us.

Note- We cannot make any changes that are saved in the database. Changing Drupal settings will not work. There's got to be a login file on the server we can delete.

  • Take a look at this answer on Stackoverflow stackoverflow.com/questions/6352381/…
    – fullerja
    Commented Jun 29, 2015 at 15:04
  • While this stackoverflow article can achieve what I am asking, it makes a change to the database. If I do this, is there also a way to delete the admin login functionality.
    – Parker
    Commented Jun 29, 2015 at 15:17
  • I would suggest you to use this module to change the userlogin path and user admin path. you can configure as tough as you want and make it secure.
    – shrish
    Commented Jun 29, 2015 at 15:30

5 Answers 5


Just have an htaccess entry that redirects /user and /admin to the front page.


Well you could do a couple of things but you would need to have full access to the admin in the backend and I'm not really sure that if you are saying that the access in the backend is just changing the same database or the content is being pushed by a services type deploy module.

The first thing is hiding the login blocks, which you probably already have done this but here is a link: https://www.drupal.org/node/13777

Next, depending on your setup you will want to either forward the /user (or /user/login if you have user profiles that are on that path) to the home screen. That will make it impossible for a user to login. You could do this with an htaccess rule which is a little out of scope for Drupal Answers or do a redirect using either the redirect module or the rules module. Depending on your setup the rules could match the URL (say if the URL is admin.example.com for the admin install) and forward only the main site /user page to the home page so your users on the admin install can still access the site.

There are probably some more ways to do this, I will add more as I think of them.


There's an alternative:


This module requires a "secret" token to access the user login page:

Example: http://example.com/user/?hell0darling-XD


you can remove the login functionality technically, but if you do it, then your administrator could never log onto the site.

you can remove the registration functionality, you simply need to browse to admin/user/settings (for Drupal 6) or admin/config/people/accounts (for Drupal 7) and select the the "Only site administrators can create new user accounts" option.



The best way is not to fiddle with the core, or you may end up breaking your site (when applying updates, patches etc). Better way is to implement IP based login (with .htaccess) or use one of the available modules that restricts admin path to selected IP.

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.