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:

enter image description here

15 Answers 15


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


<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

  • 1
    This worked for me, only I didn't change the permissions to 777 for everything. Make sure you don't leave /app/etc/ writeable Commented Jun 27, 2016 at 13:05
  • @DavidWilkins: Glad that helps, I appreciate your point. Updated my answer Commented Jun 27, 2016 at 13:12
  • 1
    Thanks, This worked! I made a mistake first and change the wrong AllowOverride. Just make sure its the one under <Directory /var/www/>
    – marshy101
    Commented Jul 5, 2016 at 1:51
  • Worked like a charm. :) Commented Jul 11, 2016 at 10:38
  • 1
    Minus 1 for the 777 Commented Nov 2, 2017 at 14:56

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

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.

  • How can I do this in live hosting ? I did it in my localhost.
    – abu abu
    Commented Oct 17, 2018 at 13:12

Make sure you enabled server rewrites: http://devdocs.magento.com/guides/v2.0/install-gde/prereq/apache.html#apache-help-rewrite



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 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:




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


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 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.

  • Answer has been edited. Commented Jan 18, 2016 at 16:05
  • #1 doesn't work for me, Magento 2.1.0. It seems to work if I add index.php segment to URL
    – Codium
    Commented Aug 19, 2016 at 8:52
  • #2 also not working :(
    – Codium
    Commented Aug 19, 2016 at 9:10
  • 1
    @drupality check this article and see if you are missing something else: magenticians.com/fix-broken-magento-2-installation Commented Aug 19, 2016 at 10:26
  • read that, still no luck, something is wrong with newest Magento version. Major pain in the ass
    – Codium
    Commented Aug 19, 2016 at 11:14

open the terminal and navigate to magento web root

 $ cd /var/www/html/magento2 
Step 1.

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

Step 2.

$ php bin/magento indexer:reindex

Step 3.

make sure apache “rewrite_module” is enable and then restart the server

$ sudo a2enmod rewrite && sudo service apache2 restart

Step 4.

$ chown -R www-data:www-data /var/www/html/magento2 

Step 5.

 $ chmod -R 777 /var/www/html/magento2/

Step 6.

delete cache folder under var/cache


  • Always works :)
    – aman tilak
    Commented Jan 4, 2019 at 16:45

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 :)



bin\magento setup:static-content:deploy
  • don't forget permission too. For me, I run after that: chmod -R 777 *
    – redochka
    Commented Jan 3, 2016 at 20:14

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

How to disable static-files versioning:

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) 

Then execute next command to clear a configuration cache:

bin/magento cache:clean config
  1. 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.

  2. 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


and replace below code form line number 574

<item name="view_preprocessed" xsi:type="object">Magento\Framework\App\View\Asset\MaterializationStrategy\Symlink</item>


<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 >

  1. In core config table change value for web/seo/use_rewrites to 0 ( 1 to 0 )

  2. bin/magento cache:clean config

  3. Clearing Cache

  • @Teja Bhagwan Kollepara Thanks for smart and shortest trick to achieve the very complex problem with lot of root causes and aproachces Commented Mar 6, 2021 at 4:12

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