I know this question has been set a few times now, I can't seem to find the answer - I did the whole cache emptying of folders with "php bin/magento setup:static-content:deploy" - this seems to only work for reloading the backend css properly but not the frontend. (I had this problem with the backend in the beginning, but the content:deploy worked it out, just doesn't seem to be doing anything for the frontend).
The frontend looks bogus, the css file reference of the page seems correct... http://localhost/magento/pub/media/styles.css (at least, there is a file here).
I'm on a local Xampp (Win 8) Community Version wit Sample Data included.
Thanks for the help.
....
-
have you set developer mode, php bin/magento deploy:mode:set developer and remove var folderRakesh Jesadiya– Rakesh Jesadiya2016年05月13日 09:04:55 +00:00Commented May 13, 2016 at 9:04
-
tried this...nothing, sorry. :(tutuKid– tutuKid2016年05月13日 13:09:42 +00:00Commented May 13, 2016 at 13:09
-
have you set client mode inside stores-> Configuration->Advanced -> Developer -> workflow type to client sideRakesh Jesadiya– Rakesh Jesadiya2016年05月13日 13:21:30 +00:00Commented May 13, 2016 at 13:21
-
I just did this, and repeated your first step...now my backend is missing it's CSS file: FileError: 'localhost/magento/pub/static/adminhtml/Magento/backend/en_US/…' wasn't found (404) in styles.css ---- which I just populated again from my backup. But not, this isnt working for the frontendtutuKid– tutuKid2016年05月13日 14:28:06 +00:00Commented May 13, 2016 at 14:28
-
It just seems as if the css in media/styles.css is not being loaded properly... I just dont get it, the link is there <link rel="stylesheet" type="text/css" media="all" href="localhost/magento/pub/media/styles.css" /> ... but the frontend css folder of LUma theme is empty...I dont know if this has any effect.tutuKid– tutuKid2016年05月13日 14:41:56 +00:00Commented May 13, 2016 at 14:41
3 Answers 3
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
only change 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.i think it works for this problem.
Try this Before that take Backup
Remove everything, except
.htaccessfile frompub/staticfolderOpen up
app/etc/di.xmlfind the path"Magento\Framework\App\View\Asset\MaterializationStrategy\Symlink"and replace toMagento\Framework\App\View\Asset\MaterializationStrategy\Copy
Note: Remove entire files and folder under pub/static except .htaccess file.
For More info ref this http://www.dckap.com/blog/magento-2-admin-links-not-working-in-windows/
-
Thanks for the quick reply...it seems the backend looks better now, I can see all the products fully generated within the dashboard, but I am sorry, it's not doing anything for the frontend - still looks the same. I was wondering though...what you mean with remove everything under pub/static except .htaccess .....htaccess is OUTSIDE in the folder pub, but not /static.... I hope I wasn't misunderstood - my backend admin panel is working, its the frontend WEBPAGE that doesn't seem to be loading the theme/skin/css.tutuKid– tutuKid2016年05月13日 13:08:00 +00:00Commented May 13, 2016 at 13:08
-
delete all file under pub/static excetpt .htaccessMagento 2– Magento 22016年05月13日 13:10:43 +00:00Commented May 13, 2016 at 13:10
-
-
Now it's working or notMagento 2– Magento 22016年05月13日 13:48:58 +00:00Commented May 13, 2016 at 13:48
-
my question is, what about the other folders and files in the pub folder? /errors, /media, /opt, cron.php, get.php, index.php, static.php? Remove these too? or JUST pub/static?tutuKid– tutuKid2016年05月13日 13:53:33 +00:00Commented May 13, 2016 at 13:53
Okay, this answer worked, it is however necessary to do this during installation and before starting Magento (I am guessing the system creates faulty links afterwards which can't all be reversed?) - basically I needed to reinstall Magento with new database... another post solved this problem very well, in Solution #1:
https://magento.stackexchange.com/a/97230/39395
SOLUTION # 1
I would like you to download Magento 2 zip from magentocommerce.com/download with sample data, create new db in phpmyadmin, extract zip in htdocs folder. Install Magento 2 but do not use localhost use 127.0.0.1 in store URL and admin URL. After successful installation DO NOT run magento.
Now we are going to clear / delete caches and sessions of Magento 2. Go to following paths and delete everything:
ROOT> var> cache> DELETE ALL ROOT> var> page_cache> DELETE ALL ROOT> var> session> DELETE ALL
When Magento 2 is not in production mode, it will try to create symlinks for some static resources on local server. We have to change that behavior of Magento 2 by going to edit ROOT> app> etc> di.xml file. Open up di.xml in your favorite code editor, find the virtualType name="developerMaterialization" section. In that section below, you will find an item which needs to be modified. You can modify it by changing the following content:
Magento\Framework\App\View\Asset\MaterializationStrategy\Symlink
To:
Magento\Framework\App\View\Asset\MaterializationStrategy\Copy
Now last step, also delete old files generated in ROOT> pub> static> DELETE ALL EXCEPT .HTACCESS