Post by frasergoconsultme » Fri Jun 14, 2024 9:52 pm

Have a site which I want to setup 3 different stores on (using the same install and dataset).
The three stores are:-
https://online.abc.com
https://london.abc.com
https://manchester.abc.com

Have tried doing this (and point the subdomains to the same folder on the server), but the subdomain are not showing the correct stores.

I suspect it is an issue with the .htaccess file. Any suggestions?

Also, thoughts on how to get a landing page which will ask customers to choose which site the go to?

Code: Select all

# 1.To use URL Alias you need to be running apache with mod_rewrite enabled.

# 2. In your opencart directory rename htaccess.txt to .htaccess.

# For any support issues please visit: http://www.opencart.com

Options +FollowSymlinks

# Prevent Directory listing
Options -Indexes

# Prevent Direct Access to files
<FilesMatch "(?i)((\.tpl|\.twig|\.ini|\.log|(?<!robots)\.txt))">
 Require all denied
## For apache 2.2 and older, replace "Require all denied" with these two lines :
# Order deny,allow
# Deny from all
</FilesMatch>

# SEO URL Settings
RewriteEngine On
# If your opencart installation does not run on the main web folder make sure you folder it does run in ie. / becomes /shop/

RewriteBase /
# RewriteCond %{HTTPS} off
# RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# RewriteCond %{HTTP_HOST} !^www\.
# RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteRule ^sitemap.xml$ index.php?route=extension/feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=extension/feed/google_base [L]
# RewriteRule ^index.php?route=common/home / [L]
RewriteRule ^system/storage/(.*) index.php?route=error/not_found [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]

Header add Access-Control-Allow-Origin "*"
Header add Access-Control-Allow-Headers "origin, x-requested-with, content-type"
Header add Access-Control-Allow-Methods "PUT, GET, POST, DELETE, OPTIONS"

RewriteEngine On
RewriteCond %{REQUEST_METHOD} OPTIONS
RewriteRule ^(.*)$ $1 [R=200,L]

### Additional Settings that may need to be enabled for some servers
### Uncomment the commands by removing the # sign in front of it.
### If you get an "Internal Server Error 500" after enabling any of the following settings, restore the # as this means your host doesn't allow that.

# 1. If your cart only allows you to add one item at a time, it is possible register_globals is on. This may work to disable it:
# php_flag register_globals off

# 2. If your cart has magic quotes enabled, This may work to disable it:
# php_flag magic_quotes_gpc Off

# 3. Set max upload file size. Most hosts will limit this and not allow it to be overridden but you can try
# php_value upload_max_filesize 999M

# 4. set max post size. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value post_max_size 999M

# 5. set max time script can take. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value max_execution_time 200

# 6. set max time for input to be recieved. Uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value max_input_time 200

# 7. disable open_basedir limitations
# php_admin_value open_basedir none

# php -- BEGIN cPanel-generated handler, do not edit
# Set the “alt-php80” package as the default “PHP” programming language.
# php -- END cPanel-generated handler, do not edit
Last edited by frasergoconsultme on Mon Jun 17, 2024 8:44 pm, edited 1 time in total.

Newbie - OC 3.0.3.8 sites


New member

Posts

Joined
Sun Feb 12, 2023 4:36 am

Post by ADD Creative » Fri Jun 14, 2024 10:12 pm

Where are your subdomains taking you if not to the correct store?

www.add-creative.co.uk


Expert Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by frasergoconsultme » Fri Jun 14, 2024 11:27 pm

ADD Creative wrote:
Fri Jun 14, 2024 10:12 pm
Where are your subdomains taking you if not to the correct store?
To the default store.

Newbie - OC 3.0.3.8 sites


New member

Posts

Joined
Sun Feb 12, 2023 4:36 am

Post by ADD Creative » Fri Jun 14, 2024 11:49 pm

I assume you have configured the multi-stores in OpenCart. You need to check what HTTP_HOST is being set to for each subdomain. You could log the $_SERVER['HTTP_HOST'] or use phpinfo() to check it.

www.add-creative.co.uk


Expert Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by grgr » Sun Jun 16, 2024 9:07 am

have you set the Store URL and SSL Url correctly? WWW / Non WWW? Have you added the trailing /

https://www.london.abc.com/
or
https://london.abc.com/

-
Image Image Image
VIEW ALL EXTENSIONS * EXTENSION SUPPORT * WEBSITE * CUSTOM REQUESTS


User avatar
Active Member

Posts

Joined
Mon Mar 28, 2011 4:08 pm
Location - UK

Post by frasergoconsultme » Mon Jun 17, 2024 8:45 pm

grgr wrote:
Sun Jun 16, 2024 9:07 am
have you set the Store URL and SSL Url correctly? WWW / Non WWW? Have you added the trailing /

https://www.london.abc.com/
or
https://london.abc.com/
"/" missing from the end was the issue ;)

Newbie - OC 3.0.3.8 sites


New member

Posts

Joined
Sun Feb 12, 2023 4:36 am
Who is online

Users browsing this forum: adibranch, Google [Bot] and 24 guests