11

I have successfully installed Magento 2 on the wamp server but I'm having a slight issue of loading the admin page as it is giving me a 404. Also, when loading its homepage the default theme that is luma in my case doesn't apply and instead gives me the following errors:

Failed to load resource: the server responded with a status of 404 (Not Found)
http://127.0.0.1/test1/pub/static/frontend/Magento/luma/en_US/mage/calendar.css     
Failed to load resource: the server responded with a status of 404 (Not Found)
http://127.0.0.1/test1/pub/static/frontend/Magento/luma/en_US/css/styles-m.css 
Failed to load resource: the server responded with a status of 404 (Not Found)
http://127.0.0.1/test1/pub/static/frontend/Magento/luma/en_US/css/styles-l.css 
Failed to load resource: the server responded with a status of 404 (Not Found)
http://127.0.0.1/test1/pub/static/frontend/Magento/luma/en_US/css/print.css 
Failed to load resource: the server responded with a status of 404 (Not Found)
http://127.0.0.1/test1/pub/static/frontend/Magento/luma/en_US/images/logo.svg    
Failed to load resource: the server responded with a status of 404 (Not Found)
http://127.0.0.1/test1/pub/static/frontend/Magento/luma/en_US/css/styles-m.css 
Failed to load resource: the server responded with a status of 404 (Not Found)
http://127.0.0.1/test1/pub/static/frontend/Magento/luma/en_US/css/styles-l.css 
Failed to load resource: the server responded with a status of 404 (Not Found)
http://127.0.0.1/test1/pub/static/frontend/Magento/luma/en_US/requirejs/require.js 
Failed to load resource: the server responded with a status of 404 (Not Found)
http://127.0.0.1/test1/pub/static/frontend/Magento/luma/en_US/css/print.css     
Failed to load resource: the server responded with a status of 404 (Not Found)
http://127.0.0.1/test1/pub/static/frontend/Magento/luma/en_US/mage/requirejs/mixins.js 
Failed to load resource: the server responded with a status of 404 (Not Found)
requirejs-config.js:602 Uncaught ReferenceError: require is not defined
127.0.0.1/:24 Uncaught ReferenceError: require is not defined
127.0.0.1/:26 Uncaught ReferenceError: require is not defined
17

Css and js will created at run time in pub/static folder In first time,if css and js missing then run below command

if you are using windows: php bin\magento setup:static-content:deploy

if using linux of 'git bash': php bin/magento setup:static-content:deploy

  • Also, make sure you enabled Apache server rewrites – Steve Johnson Jan 7 '16 at 14:42
  • Would appreciate if you could break down the steps. How to run the Windows command? How to know if it actually worked? – Mohammed Joraid Jun 28 '17 at 19:49
11

I was also facing this problem. Admin gives 404 error and frontend didn't attach css(i.e. Luma didnot showing in proper format..).so i did these steps to solve these both problems in magento 2. 1)go to terminal and run this command

sudo gedit /etc/apache2/apache2.conf

And change:-

<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride none
Require all granted

To

<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted

chnage only AllowOverride none to All

and

2) go to terminal and run command :-

sudo a2enmod rewrite
sudo service apache2 restart

Then give the permission to your var,pub and app/etc. and then go to your admin and frontend it works properly.

  • 1
    man i tried 1000s of solution but only this one worked for me thanks a lot! – Wasif Khalil Apr 3 '17 at 6:13
8

For those who are using wamp server, then run these commands in your CLI.

C:\wamp\bin\php\php5.5.12>php.exe
C:\wamp\www\\bin\magento setup:static-content:deploy

6

I was also facing this issue. After fresh install of magento 2 with demo data when navigating to the frontend and backend too in localhost. Got MIME type mismatch errors for calendar.css and require.js. Nothing worked for me unless deployed the static content through

php bin/magento setup:static-content:deploy

in git bash and while it is default mode.

2

I was facing the same problem, I used Alan Storm solution from that article - http://alanstorm.com/magento_2_adding_frontend_files_to_your_module

use that command in ssh

find /path/to/magento2/pub/static -exec chmod 777 '{}' +
find /path/to/magento2/var/ -exec chmod 777 '{}' + 
2

Enable URL rewrites.

1) Open terminal in Ubuntu and execute these commands:

sudo a2enmod rewrite

sudo service apache2 restart

2) Make sure you have the .htaccess file in your root directory of magento, if there is no .htaccess file copy the /pub/.htaccess file and paste it in the root directory

3) Open /etc/apache2/apache2.conf file using following commands:

sudo nano /etc/apache2/apache2.conf

And change the following lines of code:

<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride none
Require all granted

To

<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted

Save and close the file by Ctrl + X

  • Restart the apache

    sudo service apache2 restart

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.