Posted on

set magento 2.4.3 website root directory ubuntu

I have upgraded Magento v2.3.3-p1 to Magento v2.4.3 successfully. When I ran the website it’s showing 404 Notfound error, due to not set the Document Root. When I ran the website http://localhost/mce243/pub/ it’s showing, but not redirecting other than home page.

And I have updated the /etc/apache2/sites-available/000-default.conf file with the below code in ubuntu for Document Root directory, but not working for me.

<VirtualHost *:80>

ServerAdmin [email protected]
DocumentRoot /var/www/html/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory “/var/www/html”>
AllowOverride all
</Directory>
</VirtualHost>

<VirtualHost http://10.10.10.120/mce243/:8080>

ServerAdmin [email protected]
DocumentRoot /var/www/html/mce243/pub
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

And also updated .htaccess file

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

both are not working.

In my system having multiple Magento instances.

Can you please help me how to run the specific website with pub index.php as root?

Leave a Reply

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