How to create Opencart multisite in Subfolder/Directory?


Here are the steps I took:

 

 

1. Modify the .htaccess file in the root of your OpenCart directory.
Once it is open, find the line which looks like the following:

 RewriteRule ^([^?]*) index.php?_route_= [L,QSA]

After you have found this code, add a line above it with the code:

 RewriteCond %{REQUEST_URI} !^/au/.*$

2. Create folder: /au/

3. Inside the folder “/au/”, add a new php file called “index.php” which contains the following code:

 <?php include('../index.php');

4. While still inside the “/au/” folder, add the standard .htaccess file for OpenCart and then make the following changes:

A) Update the line which reads “RewriteBase / ” to reflect your folder.
For example, I would write the line as: RewriteBase /au/

B) Directly after this line, add the following code:

 RewriteRule ^image/([^?]*) /image/ [L,QSA] RewriteRule ^catalog/([^?]*) /catalog/ [L,QSA] RewriteRule ^download/([^?]*) /download/ [L,QSA]

5. Inside the root of your OpenCart Shop, edit the main “index.php” file and make the following changes:

A) At the top of the file, replace this block of code:

 if (file_exists('config.php')) { require_once('config.php'); }

with this line:

require_once($_SERVER["DOCUMENT_ROOT"] . '/config.php');

B) If you are using vQmod, you will also have to replace the code:

 require_once('./vqmod/vqmod.php');

with:

 require_once($_SERVER["DOCUMENT_ROOT"] . '/vqmod/vqmod.php');

 

6. Now at this step, the site should work!
You may find some issues with relative links on your website, however I never found anything that I couldn’t work around.

 

Source: https://mywork.com.au

 



Find More related How to create Opencart multisite in Subfolder/Directory?


Have any Question or Comment?

Leave a Reply

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