0

I installed magento 2.4 on a testserver where i can not change the root folder to pub. I changed the .htaccess in the root to:

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

I can see the site logo and menu, but the content part gives a 404

When i add pub/ to the url everything is showing.

How to changed the .htaccess so that adding /pub is not nesseccary

1
  • If possible, its better to set the document root of the host to the /pub folder. Do you already set 'directories' => [ 'document_root_is_pub' => true ] in env.php? See the docs. May 11 at 4:32

1 Answer 1

0

Update below code in Magento root .htaccess

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
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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