-1

I restored my Drupal 7 site from backup and now can't get to the admin page.

Getting a Drupal 404 page on example.com/index.php?q=admin as well as example.com/?q=admin.

Needless to say admin/ also gives a 404.

Same file system and database were working yesterday.

6
  • Is the .htaccess file intact in the webroot?
    – Kevin
    Commented Nov 18, 2017 at 2:07
  • oh yes. I'm fairly sure it's the default. That wouldn't have an effect on running ?q=admin would it?
    – MikeiLL
    Commented Nov 18, 2017 at 3:29
  • Did you make any changes for server configuration? If no then just replace the .htaccess file from fresh drupal installation files.
    – Prem Patel
    Commented Nov 18, 2017 at 5:55
  • I can get to example.com/user and log in which seems to do the trick. Very new to Drupal. Is this normal?
    – MikeiLL
    Commented Nov 19, 2017 at 5:34
  • Are you sure it was a 404 and not 403?
    – Akko
    Commented Nov 20, 2017 at 9:02

2 Answers 2

1

I encountered this problem on a localhost install of Drupal 8 on Ubuntu18.04. I could see the base url page but every link into my site was 404 (e.g. any link from the admin bar).

Clean URLs

I started with the Drupal.org page, "Page Not Found" Errors on every page except homepage where I found this:

To configure mod_rewrite from .htaccess, the Apache config needs to allow at minimum "FileInfo" overrides. In order to make the simple DirectoryIndex test work, apache needs to allow "Index" overrides.

Then I found a solution which translated this for me into practical steps. I enabled "Clean URLS", following a hint on Install Drupal on Ubuntu 18.04 Bionic Beaver Linux.

  1. edit Apache's default site configuration /etc/apache2/sites-enabled/000-default.conf

    $ sudo vim /etc/apache2/sites-enabled/000-default.conf
    
  2. insert the following just after the line that has DocumentRoot /var/www/html

    <Directory /var/www/html/>
               Options Indexes FollowSymLinks
               AllowOverride All
    </Directory>
    
  3. restart Apache

    $ sudo systemctl restart apache2
    
0

The answer appears to be that the /admin or ?q=admin path only exists when you are logged in to Drupal as an administrator.

The login page is reached at example.com/user/login.

5
  • This isn't really an answer, it could be a permission issue, bad code in a custom module, busted database table, etc. The path always exists, you proved that it does, but other users not being able to access it sounds like a permission issue.
    – Kevin
    Commented Nov 26, 2017 at 20:03
  • Do you mean that example.com/admin should be bringing up a login page?
    – MikeiLL
    Commented Nov 26, 2017 at 20:15
  • It should say access denied if you are not logged in, or are logged in and your role does not have permission to access administrative pages or something of that nature. It will only bring up a login page IF you are not logged in if you installed something like LoginToboggan or one of those contrib modules that puts login forms on 403 responses.
    – Kevin
    Commented Nov 26, 2017 at 20:21
  • Might there be a 403 page in the theme that might be missing or have bad permissions or something, since the 404 page that's getting served is a Drupal one?
    – MikeiLL
    Commented Nov 27, 2017 at 0:20
  • 403/404 pages are served directly from Drupal unless you override them with a node. Getting a 403 on /admin doesn't change the underlying cause.
    – Kevin
    Commented Nov 27, 2017 at 0:29

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.