cancel
Showing results for 
Search instead for 
Did you mean: 

404 Not Found after fresh Magento 2.4.2 installation

404 Not Found after fresh Magento 2.4.2 installation

I have never had any issues with fresh install of magento before 2.4.1. I have a new Linux VM machine (Ubuntu server 18.04).
  1. Installed PHP 7.4 , Apache and Mysql from this link Installation of PHP, MYSQL and APACHE

  2. Installed Composer mylonestar

  3. Installed Elastic search

  4. Created composer project using this command composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition=2.3.2-p1 <install-directory-name>

  5. Added sample data using php bin\magento sampledata:deploy

  6. Installed magento using following command

    php bin/magento setup:install --base-url=http://localhost/me242 --backend-frontname=admin --db-host=localhost --db-name=me242 --db-user=root --db-password='dbpas' --admin-firstname=firstname --admin-lastname=lastname --admin-email=fn@ln.com --admin-user=user --admin-password='passs!' --language=en_US --currency=USD --timezone=America/Los_Angeles --use-rewrites=1 --search-engine=elasticsearch7 --elasticsearch-host=localhost --elasticsearch-port=9200

This has worked for me fine up until 2.4.1. I am trying all possible ways to get it up and running 2.4.2 version but getting 404 error right away. The requested URL was not found on this server.

Can someone help me troubleshoot this in right direction.

Edit 1: I did not upgrade from 2.4.1 to 2.4.2. it was a fresh install.

4 REPLIES 4

Re: 404 Not Found after fresh Magento 2.4.2 installation

Hello @dayanahane0fed ,

 

The command you used to install magento is incorrect, it is installing Magento 2.3.2-p1 version of Enterprise Edition.

To install latest version of

Magento Open source, run below commands :

 composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition <install-directory-name>

Magento Commerce Edition, run below commands :

 composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition <install-directory-name>

 To install specific version, install by following command :

composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition=2.4.0 <install-directory-name>

Reference : https://devdocs.magento.com/guides/v2.4/install-gde/composer.html

Let us know if it works with these commands !

Problem Solved ? Click on 'Kudos' & Accept as Solution ! Smiley Happy

Re: 404 Not Found after fresh Magento 2.4.2 installation


Move Index.php file from pub to magento root dir and replace 

require __DIR__ . '/../app/bootstrap.php';

to

require __DIR__ . '/app/bootstrap.php';

Then  magento root having 2 files  1 .htaccess and 2 .htaccess.sample
need to rename .htaccess.sample to .htaccess

Re: 404 Not Found after fresh Magento 2.4.2 installation

I try 2 solution both work for me 
Solution 1: change in root .htaccess 
RewriteRule .* /pub/$0 [L] = > RewriteRule .* /magento/2.4.2/pub/$0 [L]

change web/unsecure/base_url => http://127.0.0.1/magento/2.4.2/pub/

and web/secure/base_url =>  https://127.0.0.1/magento/2.4.2/pub/

Solution 2: change web/unsecure/base_url => http://127.0.0.1/

and web/secure/base_url => https://127.0.0.1/

then in  /opt/lampp/etc/httpd.conf  file 
DocumentRoot "/opt/lampp/htdocs" = > DocumentRoot "/opt/lampp/htdocs/magento/2.4.2"
<Directory "/opt/lampp/htdocs"> =>  <Directory "/opt/lampp/htdocs/magento/2.4.2">

then server restart


 

 

Re: 404 Not Found after fresh Magento 2.4.2 installation

Hello prayden_aston

 

Great contribution. Smiley Wink

 

BUT, Magento will include CSS/JS/GIF/ICO/etc static content like so:

 

https://YOURSITE/magento_root_dir/static/...

This will leave the Magento front- and backend bareboned, because the static directory is a subdirectory within the "pub" directory.

 

So https://YOURSITE/magento_root_dir/static/... has to be redirected to https://YOURSITE/magento_root_dir/pub/static/... like this:

 

In  https://YOURSITE/magento_root_dir/.htaccess, directly below "RewriteEngine on" add the following directive:

 

RewriteRule ^static/(.*)$ /magento_root_dir/pub/static/$1 [R=301,NC,L]

 

This also works for Magento 2.4.3 installs or upgrades to Magento 2.4.3.