cancel
Showing results for 
Search instead for 
Did you mean: 

After configure apache virtual host all subpages became "404 not found"

After configure apache virtual host all subpages became "404 not found"

I have my Magento (2.3.3) installed with apache (2.4) and running on the following path:

 

 

/var/www/html/magento-prod

That is, to access my store the url is:

 

http://<my IP>/magento-prod/

To use my domain, I made the DNS appointment to my IP. Then, I configured the apache (2.4) virtual host:

 

<VirtualHost *:80>
        ServerAdmin email@exemple.com
        ServerName exemple.com
        ServerAlias www.exemple.com
        DocumentRoot /var/www/html/magento-prod/

        <Directory /var/www/html/magento-prod/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

But then, all pages became "404 - not found" and the layout gets messy:

 

Screen Shot 2020-05-14 at 23.05.34.png

 

If I comment the DocumentRoot /var/www/html/magento-prod/ code, the site return to normal.

 

Why is this happening?

 

Some other information:

 

- Apache rewrite is on

 

- I changed the apache2.conf file:

 

<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride all
        Require all granted
</Directory>

- the ./htaccess file exists and the RewriteEngine is on

 

 

 

 

 

 

 

 

 

1 REPLY 1

Re: After configure apache virtual host all subpages became "404 not found"

1- Make sure there's file/htaccess/index or whatever in directory you want to open, 404 may come from that Smiley Wink

 

2 - Try using one below, eventually replace your port:

 

 <VirtualHost *:80>

     DocumentRoot "C:/Microsoft/Workspace/myphpwebsite"

     ServerName myphpwebsite.local

  </VirtualHost>

3 - The question is your Apache running/serving on port 8088? For example my xamp is running on 80 and 443...

 

4 - Xamp control panel is very handy, it has nice logs button that will open your log files to show you php and apache errors etc. check it out.

 

Try going with default port, if it works it means that you need to play with ports if you really want to.

 

just a quick tip, .com is shorter than .local and if you're using chrome and it works like mine then most of the time something. local will redirect you to google search (and I like my search there, you can switch it off.

 

Hope it works!

Thank You!