Posted on

Magento 2 404 on all pages/files (except homepage)

I setup a Ubuntu server with the LAMP at my home network for testing. I downloaded and extracted it into /var/www/html and started the installation process. The check was OK, I created the database, the hostname is set to, installation seemed to be OK.

But when I clicked the “Launch Magento Admin” at success page, it threw 404. So I visited and the homepage showed, but it was only blank HTML – no styles or other things. I checked the page source code, the styles are linked there

<link rel=”stylesheet” type=”text/css” media=”all” href=”” />
<link rel=”stylesheet” type=”text/css” media=”all” href=”” />
<link rel=”stylesheet” type=”text/css” media=”screen and (min-width: 768px)” href=”” />
<link rel=”stylesheet” type=”text/css” media=”print” href=”” />

But when I want to view the file, I got 404.
First I thought the .htaccess is missing/ignored, but .htaccess in Magento root has 322 lines and adding random characters to it causes an internal server error, so the .htaccess is working.

Next thing I checked was the /pub/static directory, where all the styles are linked to. But it seems to be a bit empty:

[email protected]:/var/www/html$ tree pub/static
├── deployed_version.txt
└── frontend
└── Magento
└── luma
└── en_US
└── requirejs-config.js

What I did wrong? How to fix it? Still didn’t do any work, so deleting everything and starting over is acceptable, but tried 2 times and still the same result.

Rafael Corrêa Gomes provided an answer on how to recreate the missing files. However, the problem is with permissions settings, as the installer has no permissions to modify the files it creates during installation. My problem is caused by Apache and permission, so it’s a bit off-topic for this forums, as it has nothing to do with Magento.

Leave a Reply

Your email address will not be published. Required fields are marked *