I have installed Magento 2 successfully.
When i am trying to open front end that looks like this picture and backend shows 404 error. how to solve this?
Deploy static content using Magento 2 CLI. If you don't know how to do it, I have written everything in the answer below with the reasons why this happens and how to solve it. Please check it out:
After static content deploy my js and css not loading because in url deploy version is added so insert Query in my database.
INSERT INTO core_config_data (scope, scope_id, path, value) VALUES ('default', 0, 'dev/static/sign', '0');
Or in Admin below screenshot setting static file settings
I hope this will work
Solution : 2 Permission issue so correct your permissiom first of all Command in your teminal
chmod -R 777 var pub
php bin/magento setup:static-content:deploy -f
php bin/magento cache:flush
Solution: 3 Deploy according to your language.
bin/magento setup:static-content:deploy en_US nl_NL -f
php bin/magento cache:flush
I hope this will help you
If you are using wamp server on windows then
C:\wamp\bin\php\php5.5.12>php.exe C:\wamp\www\<Magento root directory>\bin\magento setup:static-content:deploy in your CLI
.
have been in the same situation, and concluded it was because of deleting htaccess file also in pub/static.
If using some VCS you can recover it easily or as indicated in this answer go to the official Magento2 repository and retrieve your missing file.
You need to deploy static content.
Run
php bin/magento setup:static-content:deploy
From your root
php bin/magento cache:flush
and done reindex using php bin/magento indexer:reindex
.
Commented
Jun 17, 2016 at 6:14
Run these commands below, it normally resolves many issues including that.
alias mage="php -d memory_limit=-1 -f bin/magento"
chmod -R 775 pub/static/ var/ pub/media/ &&
rm -rf var/view_preprocessed/ var/cache/ var/page_cache/ var/tmp/ var/generation/ pub/static/frontend/ ;
php -r "opcache_reset();"
mage cache:flush &
mage indexer:reindex &
mage setup:static-content:deploy;
mage setup:upgrade &&
mage setup:db-data:upgrade &&
mage dev:source-theme:deploy &&
chmod -R 775 pub/static/ pub/media/ var/
Run below command in your current root ( mage22 )
php magento setup:static-content:deploy
Just Open the
MAGENTO_ROOT/app/etc/di.xml
and replace below code form line number around 574
<item name="view_preprocessed" xsi:type="object">Magento\Framework\App\View\Asset\MaterializationStrategy\Symlink</item>
replace
<item name="view_preprocessed" xsi:type="object">Magento\Framework\App\View\Asset\MaterializationStrategy\Copy</item>
Clear cache, deploy static content and check now.
Hope this helps.
If you have added new code or made any change in code then you have to compile the code for that you can run the following commands :
1) Go to your Magento project root directory.
2) sudo rm -rf var/cache var/generation var/di
3) sudo php bin/magento setup:upgrade
4) sudo php bin/magento setup:di:compile
5) sudo chmod 777 -R var/
after this can restart your server
sudo /etc/init.d/apache2 restart
and see your admin panel hope it would be running.
For those who are still having issues loading backend (admin portal), - for me it was always throwing a 404, its just a matter of changing the AllowOverride directive from "none" to "all" in the respective document root.
<Directory "/var/www/html">
AllowOverride All
Order allow,deny
Allow from all>
</Directory>
And finally, restart apache/httpd and load your site again !
if you are using xampp server use bellow command in your cmd to load static files:
D:\xampp\php> php.exe D:\xampp\htdocs\<Magento root directory>\bin\magento setup:static-content:deploy -f
mod_rewrite
enable