Showing results for 
Search instead for 
Did you mean: 

Redirect documentroot to magento2 folder

Redirect documentroot to magento2 folder

Hi All,


I tried to find information on how to do this the right way but it breaks the installation. Do you have any document how I can get right of to just be ? 


I tried the virtual directory like so:-


sudo nano /etc/apache2/sites-available/magento.conf


<VirtualHost *:80>
    DocumentRoot /var/www/html/magento2/pub
    <Directory /var/www/html/magento2/pub>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
sudo a2ensite magento.conf
sudo a2dissite 000-default.conf
sudo systemctl restart apache2.service

But this broke my front end but admin side work. So I reverted back. 

Does anyone have any solution?


Thanks in advance.




Re: Redirect documentroot to magento2 folder

Hi @ijaved,


Here's the documentation for Apache:


Is you magento root on /var/www/html/magento2 or /var/www/html/magento2/pub (is pub the subdirectory of Magento2?).
If guess you need to remove de pub/ part on the vhost configuration.

If you've found one of my answers useful, please give "Kudos" or "Accept as Solution"

Re: Redirect documentroot to magento2 folder

@Damian Culotta


I tried removing the pub too but didnt help. I basically copied over content of magento2 folder to apache root folder var/www/html and tried to run setup from there but it gets stuck at step 3 of the process. I am thinking of re-downloading from git and try again.

So far I have not found single useful document which basically tells me how to configure a type of magento installation. I read somewhere that you can add store web address but I am not sure if that will help.