0

I recently upgraded one Magento installation on my local from 2.3.6-p1 to 2.4.2, and then I started getting 404 error for all pages on front end and backend, below are the technical details of server, and few tries I already made:

values set in httpd.conf (as I run multiple websites so I place them in subdirectory of /var/www/html)

Listen 192.168.1.119:80
Timeout 600
Include conf.modules.d/*.conf
User apache
Group apache
ServerAdmin root@localhost
<Directory />
    AllowOverride none
    Require all denied
</Directory>
DocumentRoot "/var/www/html"
<Directory "/var/www">
    AllowOverride All
    Order allow,deny
    Allow from all
    # Allow open access:
    Require all granted
</Directory>
# Further relax access to the default document root:
<Directory "/var/www/html">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    Allow from all      
    Require all granted
</Directory>

root .htacces file:

<IfModule mod_rewrite.c>
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
</IfModule>

Note: I added ifmodule statement here to confirm that mod rewrite is installed and working.

I have cleared all cache and generated folders using the command below:

rm -rf pub/static/frontend/* pub/static/adminhtml/* var/cache/ var/generation/ var/page_cache/ var/view_preprocessed/ var/composer_home generated/

and then recompiled and deployed, but not working for me, can anyone help me for the same.

1
0

Change DocumentRoot "/var/www/html" to DocumentRoot "/var/www/html/pub" and reload apache.

Please read more details in this thread frontend and admin not working magento 2.4.2 upgrade where I explained why this is needed.

Also, there is an answer there from @iphigenie https://magento.stackexchange.com/a/332405/35330 that attempts to solve the problem of using subfolders for running Magento.

3
  • I am running multiple website under /var/ww/html using sub directories like mydir1, mydir2 and even if I change document root to pub, the path /var/www/html/pub doesn't exist, as the pub folder is inside my subdirectory and its present in each magento installation I have. – NileshPlus91 Mar 30 at 6:47
  • I updated my answer, check it out, maybe it helps – Diana Botean Mar 30 at 6:53
  • 1
    Sorrry for very much delayed response, but finally configured Apache httpd.conf to have pub as root directory for my virtual host entry for the particular website. – NileshPlus91 May 26 at 8:26

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.