Admin url is showing 404 error after installing magento 2 on wamp server and frontend design is all messy and css is not linked to it.Error visuals are shown below.
Frontend error:
First of all, apply proper permissions, enable apache rewrite_module
and refresh apache server.
chmod -R 777 /var/www/html/MAGENTO_2_ROOT_DIRECTORY/
sudo a2enmod rewrite
sudo service apache2 restart
For messy frontend, run following command from Magento root:
php bin/magento setup:static-content:deploy
Now clear var
directory except .htaccess
file and check admin. If you get 404 page, there may be an issue of Symlink
. Fot this, Edit apache config
file
sudo gedit /etc/apache2/apache2.conf
and replace this code :
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride none
Require all granted
with
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
Note: changed AllowOverride none
to AllowOverride All
Now restart apache sudo service apache2 restart
and check admin. This should fix admin 404 issue.
Also make sure, you don't leave /app/etc/
directory writeable
AllowOverride
. Just make sure its the one under <Directory /var/www/>
Commented
Jul 5, 2016 at 1:51
For those who are using wamp server on windows localhost then,
you can try this:
C:\wamp\bin\php\php5.5.12>php.exe C:\wamp\www\<Magento root directory>\bin\magento setup:static-content:deploy
in your CLI.
Fixed the same issue faced.
as mentioned above run the command php bin/magento setup:static-content:deploy
in your Magento 2 installation directory through terminal and give permission.
For admin side this is the error (404) because:
<Directory "/var/www/html">
AllowOverride all
</Directory>`
was not present in the end of file /etc/apache2/sites-available/000-default.conf
before </VirtualHost>
. Also make sure that mod_rewrite
is enable by entering command:
a2enmod rewrite
Added that line and restarted apache2. Can now access the admin. hope it helps.
Make sure you enabled server rewrites: http://devdocs.magento.com/guides/v2.0/install-gde/prereq/apache.html#apache-help-rewrite
SOLUTION # 1 (IF YOU WANT TO EDIT XML FILE)
I would like you to download Magento 2 zip from magentocommerce.com/download
, 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 <item name="view_preprocessed" xsi:type="object">
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
I personally tried it on my localhost using MAMP, EasyPHP DevServer, Xampp and Wampp and successfully installed and using Magento 2. For further you can check out this link: Magento 2 CSS and JavaScript not loading from correct folder
SOLUTION # 2
Install Composer. Now I would like you to download Magento 2 zip from magentocommerce.com/download
, 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 verify Composer installation, Deploy static content, clear / flush Magento cache and reindex the Magento 2 blocks. To perform all above actions, press WINDOWS KEY + R to open RUN dialog and type “cmd” to open Command Prompt.
Type “cd PATH_TO_YOUR_MAGENTO2_FILES” to enter in Magento 2 ROOT directory.
Now to verify Composer installation in above directory, type “composer install”.
If you get any error in this step, please check your Composer installation
In this step, we are setting up static content to deploy on our Magento store. To perform this, type “php bin/magento setup:static-content:deploy”.
If you get any error, check your PHP.EXE and PHP.INI Environment Variable
Clear / Flush Magento cache by typing “php bin/magento cache:flush” in CMD.
And finally, to Reindex Magento Static Blocks type “php bin/magento indexer:reindex”.
You are done with successful installation of Magento 2.
open the terminal and navigate to magento web root
$ cd /var/www/html/magento2Step 1.$ php bin/magento setup:static-content:deployStep 2.
$ php bin/magento indexer:reindexStep 3.
make sure apache “rewrite_module” is enable and then restart the server
$ sudo a2enmod rewrite && sudo service apache2 restartStep 4.
$ chown -R www-data:www-data /var/www/html/magento2Step 5.
$ chmod -R 777 /var/www/html/magento2/Step 6.
delete cache folder under var/cache
http://gotechnies.com/css-javascript-files-loading-magento-2-installation/
I installed magento2 (on xampp win7) with composer:
1.git clone https://github.com/magento/magento2/tree/master
2.cd magento2
3.git checkout master
4.composer install
5.php bin/magento sampledata:deploy
6.composer update
then i installed magento2 with web installer and got 404 error (page not found) on both front-end back-end pages. then i opened magento2\app\etc\di.xml and removed this line
<item name="view_preprocessed" xsi:type="object">Magento\Framework\App\View\Asset\MaterializationStrategy\Symlink</item>
also i removed env.php and did web installation once again after that front-end and back-end works fine :)
run
bin\magento setup:static-content:deploy
For UBANTU OS magento Frontend to work you just need to go to your magento directory and write this command sudo bin/magento setup:static-content:deploy
Simplest solution form admin url is
in core config table change value for web/seo/use_rewrites to 0 ( 1 to 0 ) and all cache folder form var
Second neet to disable versioning form admin
If you do not want to use static files versioning you can disable this feature in the Magento admin area:
It is possible to change this setting for default scope using the following MySQL query:
INSERT INTO 'core_config_data' ('path', 'value')
VALUES ('dev/static/sign', 0)
ON DUPLICATE KEY UPDATE value = 0;
Then execute next command to clear a configuration cache:
bin/magento cache:clean config
Remove all files from pub->static folder and fire upgrade command and deploy command so that once again folder and files will be seen in pub->static folder then open admin panel or front-end. This works for me.
If still you don't get then delete all files and folder from var->generation folder and once again fire PHP upgrade and deploy command and check whether admin and front-end is visible properly.
You move to directory install magento2. After, you using command in terminal: bin/magento setup:static-content:deploy
and set permissions for pub, var
folder have 770 permissions
Just Open the
MAGENTO_ROOT/app/etc/di.xml
and replace below code form line number 574
<item name="view_preprocessed" xsi:type="object">Magento\Framework\App\View\Asset\MaterializationStrategy\Symlink</item>
TO
<item name="view_preprocessed" xsi:type="object">Magento\Framework\App\View\Asset\MaterializationStrategy\Copy</item>
Please check once you enabled server rewrites: http://devdocs.magento.com/guides/v2.0/install-gde/prereq/apache.html#apache-help-rewrite
The following worked for me >
In core config table change value for web/seo/use_rewrites to 0 ( 1 to 0 )
bin/magento cache:clean config
Clearing Cache