Gerome:
Magnus,
Thank you so much for you for your post !! This is of a great help.
I guess I should add that to the documentation of the module right ?
Hi Gerome,
I'm happy you liked my "MultiSite Module for Dummies" contribution. Here is another section for your documentation:
Consider how you will handle http 404 Not Found errors
As a good webmaster, you are never the source of a "page-not-found" error. You regularly use a link checker to verify that the linking structure of your web site is intact. You verify your web server log for 404 errors coming from external links pointing to non-existent pages on your site.
When the URL for a page needs to be corrected, you redirect requests for the old or incorrect location to the new location of the page. On the rare occasion when you just remove a page, you insert a "Page removed" page for human visitors that also gives a 410 "Gone" status to search engine spiders.
For good webmasters, "page-not-found" errors can only occur because someone typed in an incorrect URL into the address bar of their browser. Many sites intercept such errors using a 404 script. If your .htaccess file contains
ErrorDocument 404 /http404.php
```the http404.php script will be executed for each request for a non-existent page.
Since you're now using the MultiSite module, you once again need to know what domain you're in so that you show the right "not-found" page. Here is an example of a http404.php script that handles the situation differently depending on the site:
// http 404 not found error handler for multisite installations.
// The http 404 status is already set here.
// Just call the right page for the current site.
switch($_SERVER['HTTP_HOST']) {
case 'site1.com':
require('http://site1.com/zencart/index.php?main_page=page_not_found');
break;
case 'site2.com':
require('http://site2.com/en/pages/not-found/');
break;
case 'site3.com':
require('http://site3.com/page-not-found.php');
break;
}
// Make sure that code below does not get executed when we redirect.
exit;
http://<domain>/<path>/index.php?main_page=<page>
However, Zen Cart does not automatically intercept any errors in the <domain> or <path> segments of the URL. That's why you need a separate 404 error script like the one described above.