0

I have installed Magento 2.4 on Apache 2 sever running on Ubuntu 20.x

When I try to load the magento root directory on browser, I get

Not Found The requested URL was not found on this server.

I have the .htaccess (default file created by install) like this

RewriteEngine on
RewriteCond %{REQUEST_URI} !^/pub/
RewriteCond %{REQUEST_URI} !^/setup/
RewriteCond %{REQUEST_URI} !^/update/
RewriteCond %{REQUEST_URI} !^/dev/
RewriteRule .* /pub/$0 [L]
DirectoryIndex index.php

Can someone help me understand what this is trying to do?

My understanding is, this is looking for index.php file (which is not present in the root installation directory - and thus the error).

I have a feeling that the error has to do something with the line

RewriteRule .* /pub/$0 [L]

Thanks in advance!

1 Answer 1

1

Magento 2 should be loaded by apache from the magento_root/pub directory. In Magento 2.4.2 this has been enforced by a new magento_root/.htaccess file. The rewrite rules here are attempting to rewrite all access to magento_root to magento_root/pub

You should configure the document root of your apache magento 2 server configuration to

DocumentRoot "/var/www/html/magento2/pub"

Where /var/www/html/magento2 is the path to your magento_root directory.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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