2

Problem

Was creating a module. Everything was good, but at some point admin page just stopped working. Can't say on what paticular moment, cause I used bin/magento to flush caches, compile and deploy. Now it's loading only main page localhost/. No other links. Error 404.

What was done

  1. Checked, if the right admin url in /Library/WebServer/Documents/app/etc/env.php.

  2. sudo chmod -R 777 ./ -> Flush cache -> sudo chmod -R 777 ./ -> Deploy static content -> sudo chmod -R 777 ./ -> Compile -> sudo chmod -R 777 ./.

  3. Copied .htaccess to the root from source folder on the site.

Additional information

It happens the second time. First time I thought it was one-time mistake. I can't remember, if the symptoms are exactly the same, but they are similar. That time was Magento 2.0. Now it is 2.1.

Raphael at Digital Pianism
  • 70,385
  • 34
  • 188
  • 352
D.R.
  • 315
  • 1
  • 5
  • 19
  • check this: http://magento.stackexchange.com/questions/91087/magento-2-admin-url-not-working-and-loaded-frontend-is-all-messy – MaYaNk Jul 02 '16 at 07:58
  • 1
    @mayank thank you for the answer. It wasn't workng on itself, but I combined it with another and it helped. – D.R. Jul 02 '16 at 10:17

2 Answers2

3

404 pages on native Magento pages while developing a module are often a consequence of a bug in the said module.

To find out try disabling the module and see if the error goes away:

php bin/magento module:disable Vendor_Module

To find out what the error is I suggest you switch to developer mode if not already done as it provides way more verbosity in logs and errors:

php bin/magento deploy:mode:set developer

Now try access the page that triggers the 404 and check var/log files content.

Raphael at Digital Pianism
  • 70,385
  • 34
  • 188
  • 352
  • Thank you for the answer. It was already in devmode. After disabling module the main page lost it's css and js. Admin page still triggers 404. Deploying static content hadn't restored page's js and css. In logs just some old stuff, but noting actual in any of 4 files (debug, exception, install, system). – D.R. Jul 02 '16 at 08:33
2

I fixed by combining both advice. Can't say, what exactly helped, but here is the sequence of my actions:

  1. php bin/magento deploy:mode:set developer
  2. sudo chmod -R 777 /path/to/my/root/folder
  3. php bin/magento module:disable Vendor_Module
  4. sudo chmod -R 777 /path/to/my/root/folder

Styles and js were losted somewhere around this step

  1. In .../apache2/httpd.conf

set:

<Directory />
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
and
<Directory />
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
  1. Uncommented (deleted the #) in the same file (.../apache2/httpd.conf)

    LoadModule rewrite_module libexec/apache2/mod_rewrite.so

  2. sudo chmod -R 777 ./ -> Flush cache -> sudo chmod -R 777 ./ -> Deploy static content -> sudo chmod -R 777 ./ -> Compile -> sudo chmod -R 777 ./.

  3. sudo apachectl restart

  4. At first look everything is ok now.
D.R.
  • 315
  • 1
  • 5
  • 19