Getting 404 Error on Second Domain – Magento 2 Multi-Store Fix

magento2magento2.2

So I have a LEMP stack set up on a staging server and on my local. I have it set up as a Multi-Store. The staging server and local are identical. Except that the local is running off of Laravel Valet and the Staging server is just a regular LEMP stack.

I have the Multi-Store setup, on my local it works perfectly. For the secondary domain it shows me exactly what I should expect to see. But on the Staging server I can verify it's loading the secondary site, but I get a 404 error.

The only difference that I can find is that on my local Laravel Valet is running off of /index.php and that is where I had to set the variables to load the secondary site. But on the Staging server I'm running a specific Magento config and it's loading based on /pub/index.php And this is the site that comes up with a 404 error on the secondary domain.

I can't figure this one out. The index.php files are similar but there are a few differences. All I can assume is that slight difference in document root is causing the issue. The ideal configuration I'm sure is that the document root be set to the /pub/ directory, but this is the method that I can't seem to get working. Any help is much appreciated.

UPDATE: I tried to set the staging server to just use / instead of /pub like my local is using. Unfortunately I still got a 404 on the secondary domain, and then on the primary all the assets were missing because of an incorrect path on those elements now.

UPDATE: I didn't have a home page created but it stilled showed on local. I created one anyway, still doesn't work. Oddly enough all other URL's work. Try to go to a category page, it works. Try to go to the login page, it works. The only thing that I think doesn't work is the home page that I've found so far.

Best Answer

Don't have enough for comments.

Check the .htaccess file and clear the cache and reindex everything.

Related Topic