Admin URL Is Not Working in Magento 2
You’ve just installed Magento 2 on a wamp server, but your admin isn’t working. The 404 error is displayed and the frontend is displayed without CSS. Perhaps, we know how to solve the problem.
This is the illustration of a possible frontend error:
To fix the issue with the backend, you should:
- Apply appropriate permissions:
1 |
chmod -R 777 /var/www/html/MAGENTO_2_ROOT_DIRECTORY/ |
- Enable apache rewrite_module:
1 |
sudo a2enmod rewrite |
- Refresh apache server:
1 |
sudo service apache2 restart |
Now, your backend is fixed and should work properly. Therefore, let’s try to solve the issue with the frontend.
First of all, you should apply the command below from the Magento root:
1 |
php bin/magento setup:static-content:deploy |
The next step requires clearing the var directory but don’t forget about the exception – the .htaccess file. Now, you should check the admin. If 404 is displayed again, the problem is probably caused by Symlinks. Therefore, you need to edit the apache config file:
1 |
sudo gedit /etc/apache2/apache2.conf |
Find the following code snippet :
1 |
<Directory /var/www/> Options Indexes FollowSymLinks AllowOverride none Require all granted |
Replace it with the following one:
1 |
<Directory /var/www/> Options Indexes FollowSymLinks AllowOverride All Require all granted |
After the changes are applied, restart apache:
1 |
sudo service apache2 restart |
Now, check your admin once again: the 404 issue should be fixed now.
One more tip: don’t leave /app/etc/ directory writable.
And if you are using wamp server on windows localhost, simply try the following command in your CLI:
1 |
C:\wamp\bin\php\php5.5.12>php.exe C:\wamp\www\<Magento root directory>\bin\magento setup:static-content:deploy |
We hope the article was useful. It is based on the