Question

I have installed magento 2 successfully but frontend side and admin side style is not loading. Even after login to admin it gives not found(404) pageenter image description here

Base url in core_config_data:http://localhost.com/magento2/

Was it helpful?

Solution

Please validate, if your webserver uses the correct rewrites.

For Apache: allow the loading of htaccess files and usage of rewrite rules.

for nginx, use the example config provided in the magento directory.

OTHER TIPS

First of all, View the source of your page and click the css links, if it is pointed correctly it should bring you to the css page.

Please check whether you have changed Home page design from Admin Panel.

I mean go to Cms >> Pages

Open Home Page.

Click on Design tab.

Check value of "Custom Theme" under "Custom Design".

If still you find any trouble, then please provide your website's URL.

run command on Magento Root

php dev/tools/Magento/Tools/View/deploy.php

OR

Go to

dev/tools/Magento/Tools/View/ location and run command

php deploy.php

You need to deploy content
run this command in magento root directory

 sudo php bin/magento setup:static-content:deploy

I had the same issue(stylesheet not loading) but it was caused by something else.

I had changed the URLs of my website in the database and forgot to leave a "/" at the end of the url.

what I had:

http://www.example.com

https://www.example.com

what it should be:

http://www.example.com/

http://www.example.com/

clear cache after using the command below when in the root folder of your Magento 2 installation

php bin/magento cache:status

You have to provide full permission to the "pub" folder, Try to run the following command on Magento root.

chmod -R 777 pub

I had issues with this as well, but none of the above solutions were working. Some guides recommending this order of commands.

from Magento root directory

rm -r var/cache/ var/view_preprocessed
php bin/magento setup:static-content:deploy

Note from one of the answers above I believe there is no need to use sudo in front of either of those commands above. Your user should have proper permissions and the file directories should be setup properly with ownership.

What I found works for this issue is to actually either make a backup of or remove entirely rm -r pub/static or make it a backup mv pub/static pub/static.bak Then do the content deploy php bin/magento setup:static-content:deploy and then clear your browser cache (use extension to just do it on that page) and reload your page.

rm -r pub/static
php bin/magento setup:static-content:deploy

if you're on Apache

sudo vim /etc/apache2/apache2.conf and update AllowOverride to all for the /var/www Directory

then go to your document root (where magento code resides) and

rm -rf var directory (the one that contains the cached files)
sudo php bin/magento setup:static-content:deploy –f
php bin/magento indexer:reindex (optional)

I've been battling with this for 5 days now. Finally solved the issue. There are three possible errors:

  1. Your version number is showing in your css path.
  2. Your static files are not deployed.
  3. Both 1 & 2 are the case.

To solve 1: Go to your mysql and type insert into core_config_data (config_id, scope, scope_id, path, value) values (null, 'default', 0, 'dev/static/sign', 0).

To solve 2: From your magento project root, run php bin/magento setup:static-content:deploy --force.

Remember to clean your cache for each case. php bin/magento cache:clean config

INSERT INTO core_config_data (path, value) VALUES ('dev/static/sign', 0) ON DUPLICATE KEY UPDATE value = 0;

After that run this commands

sudo php bin/magento cache:clean
sudo php bin/magento cache:flush

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top