Results 1 to 10 of 10
  1. #1
    Join Date
    May 2023
    Location
    Canada
    Posts
    50
    Plugin Contributions
    0

    Default Subdomains and Subfolders

    I have a store saved at public_html/1.5.8 with the admin folder public_html/1.5.8/MY_ADMIN

    I set up a subdomain on my Apache server using cPanel so that shop.MY_DOMAIN.com draws on public_html/1.5.8

    I waited for the DNS to recognize the change.

    I can visit shop.MY_DOMAIN.com and MY_DOMAIN.com/1.5.8/MY_ADMIN but shop.MY_DOMAIN.com/MY_ADMIN throws a HTTP 404 error.

    Is there any chance this is a Zen Cart issue not a host issue?

    Most of the documentation assumes that sites linked from a subdomain are being stored above public_html. This host does not allow that.

  2. #2
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,693
    Plugin Contributions
    9

    Default Re: Subdomains and Subfolders

    Quote Originally Posted by pixodaros View Post
    I have a store saved at public_html/1.5.8 with the admin folder public_html/1.5.8/MY_ADMIN

    I set up a subdomain on my Apache server using cPanel so that shop.MY_DOMAIN.com draws on public_html/1.5.8

    I waited for the DNS to recognize the change.

    I can visit shop.MY_DOMAIN.com and MY_DOMAIN.com/1.5.8/MY_ADMIN but shop.MY_DOMAIN.com/MY_ADMIN throws a HTTP 404 error.

    Is there any chance this is a Zen Cart issue not a host issue?

    Most of the documentation assumes that sites linked from a subdomain are being stored above public_html. This host does not allow that.
    sysadmin stuff can be tricky. hosts have reasons for doing things; whether they make sense or not, who knows.

    i do not think you have provided enough information to properly assess the situation. a few things:

    • does shop.my_domain.com reslove to the right place? ie are you sure the dns is in place and correct?
    • what do you have in your includes files for the subdomain? it's hard to imagine that your HTTP_SERVER vars would work for both URLs.


    with regards to your question, we know ZC can operate in a subdomain, and it's document root can be wherever you put it. so that means it is not a ZC issue, per se. whether you have it configured correctly is a different topic altogether. the includes files need to be correct. but based on the info provided, i am not confident about your DNS either.
    author of square Webpay.
    mxWorks has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  3. #3
    Join Date
    May 2023
    Location
    Canada
    Posts
    50
    Plugin Contributions
    0

    Default Re: Subdomains and Subfolders

    Quote Originally Posted by carlwhat View Post
    sysadmin stuff can be tricky. hosts have reasons for doing things; whether they make sense or not, who knows.

    i do not think you have provided enough information to properly assess the situation. a few things:

    • does shop.my_domain.com reslove to the right place? ie are you sure the dns is in place and correct?
    • what do you have in your includes files for the subdomain? it's hard to imagine that your HTTP_SERVER vars would work for both URLs.
    shop.MY_DOMAIN.com loads the customer-facing page.

    The configure.php files have entries like define('HTTP_SERVER', 'https://MY_DOMAIN.com');
    define('HTTPS_SERVER', 'https://MY_DOMAIN.com');

    Neither line has a www preface, just domain and TLD

  4. #4
    Join Date
    Jun 2008
    Location
    Japan
    Posts
    123
    Plugin Contributions
    5

    Default Re: Subdomains and Subfolders

    Quote Originally Posted by pixodaros View Post
    shop.MY_DOMAIN.com loads the customer-facing page.

    The configure.php files have entries like define('HTTP_SERVER', 'https://MY_DOMAIN.com');
    define('HTTPS_SERVER', 'https://MY_DOMAIN.com');

    Neither line has a www preface, just domain and TLD
    Entry for your SUBdomain in configure.php should have the subdomain 'shop.' in your server variables:
    PHP Code:
    define('HTTP_SERVER''https://shop.MY_DOMAIN.com');
    define('HTTPS_SERVER''https://shop.MY_DOMAIN.com'); 

  5. #5
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,703
    Plugin Contributions
    123

    Default Re: Subdomains and Subfolders

    > I can visit shop.MY_DOMAIN.com and MY_DOMAIN.com/1.5.8/MY_ADMIN but shop.MY_DOMAIN.com/MY_ADMIN throws a HTTP 404 error.

    There's an error in your admin/includes/configure.php.

    Be sure the DIR_WS_CATALOG and DIR_WS_HTTPS_CATALOG are the same as your storefront side. Check other values too.
    AND: when you're testing this, do NOT use Google Chrome. Use Firefox or another browser until you're sure it works, then clear cache on Chrome.

    (Google Chrome caches things like crazy and will wind up caching bad values.)
    That Software Guy. My Store: Zen Cart Modifications
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  6. #6
    Join Date
    May 2023
    Location
    Canada
    Posts
    50
    Plugin Contributions
    0

    Default Re: Subdomains and Subfolders

    Thanks a lot!

    In includes and admin/includes the values were:

    define('HTTP_SERVER', 'https://MY_DOMAIN');
    define('HTTPS_SERVER', 'https://MY_DOMAIN');
    define('DIR_WS_CATALOG', '/1.5.8/');
    define('DIR_WS_HTTPS_CATALOG', '/1.5.8/');

    I changed them to

    define('HTTP_SERVER', 'https://shop.MY_DOMAIN');
    define('HTTPS_SERVER', 'https://shop.MY_DOMAIN');
    define('DIR_WS_CATALOG', '/);
    define('DIR_WS_HTTPS_CATALOG', '/');

    I can still see the shop page, but https://shop.MY_DOMAIN/MY_ADMIN still redirects to https://MY_DOMAIN/MY_ADMIN/login.php? (ie. the old 1.5.4 install rather than the new 1.5.8a) I am trying to think of what to try next.

  7. #7
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,693
    Plugin Contributions
    9

    Default Re: Subdomains and Subfolders

    Quote Originally Posted by pixodaros View Post
    Thanks a lot!

    In includes and admin/includes the values were:

    define('HTTP_SERVER', 'https://MY_DOMAIN');
    define('HTTPS_SERVER', 'https://MY_DOMAIN');
    define('DIR_WS_CATALOG', '/1.5.8/');
    define('DIR_WS_HTTPS_CATALOG', '/1.5.8/');

    I changed them to

    define('HTTP_SERVER', 'https://shop.MY_DOMAIN');
    define('HTTPS_SERVER', 'https://shop.MY_DOMAIN');
    define('DIR_WS_CATALOG', '/);
    define('DIR_WS_HTTPS_CATALOG', '/');

    I can still see the shop page, but https://shop.MY_DOMAIN/MY_ADMIN still redirects to https://MY_DOMAIN/MY_ADMIN/login.php? (ie. the old 1.5.4 install rather than the new 1.5.8a) I am trying to think of what to try next.
    are you familiar with .htaccess files? do you have any in the shop.my_domain.com/myAdmin directory?

    also, this looks incorrect:

    Code:
    //what you have
    define('HTTP_SERVER', 'https://shop.MY_DOMAIN');
    define('HTTPS_SERVER', 'https://shop.MY_DOMAIN');
    
    //what it should be
    define('HTTP_SERVER', 'https://shop.MY_DOMAIN.com');
    define('HTTPS_SERVER', 'https://shop.MY_DOMAIN.com');
    best.
    author of square Webpay.
    mxWorks has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  8. #8
    Join Date
    May 2023
    Location
    Canada
    Posts
    50
    Plugin Contributions
    0

    Default Re: Subdomains and Subfolders

    Quote Originally Posted by carlwhat View Post
    are you familiar with .htaccess files? do you have any in the shop.my_domain.com/myAdmin directory?
    Yes, a very long .htaccess in public_html/1.5.8/MY_ADMIN and a short .htaccess in public_html/1.5.8

    I think I previously tweaked .htaccess to set the PHP version on the old ZC 1.5.4 store to 5.6.40 while the new store uses 7.4

    Code:
    <FilesMatch "\.php$">
       SetHandler application/x-lsphp74
    </FilesMatch>
    Code:
    #
    # @copyright Copyright 2003-2022 Zen Cart Development Team
    # @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
    # @version $Id: DrByte 2020 Oct 29 Modified in v1.5.8-alpha $
    #
    # This is used with Apache WebServers
    #
    # The following blocks direct HTTP requests to all filetypes in this directory recursively, except certain approved exceptions
    # It also prevents the ability of any scripts to run. No type of script, be it PHP, PERL or whatever, can normally be executed if ExecCGI is disabled.
    # Will also prevent people from seeing what is in the dir. and any sub-directories
    #
    # For this to work, you must include either 'All' or at least: 'Limit' and 'Indexes' parameters to the AllowOverride configuration in your apache/conf/httpd.conf file.
    # Additionally, if you want the added protection offered by the OPTIONS directive below, you'll need to add 'Options' to the AllowOverride list, if 'All' is not specified.
    # Example:
    #<Directory "/usr/local/apache/htdocs">
    #  AllowOverride Limit Options Indexes
    #</Directory>
    ###############################
    DirectoryIndex index.php
    
    # deny *everything*
    <FilesMatch ".*\..*">
      <IfModule mod_authz_core.c>
        Require all denied
      </IfModule>
      <IfModule !mod_authz_core.c>
        Order Allow,Deny
        Deny from all
      </IfModule>
    </FilesMatch>
    
    # allow access to the root
    <FilesMatch "^$">
      <IfModule mod_authz_core.c>
        Require all granted
      </IfModule>
      <IfModule !mod_authz_core.c>
        Order Allow,Deny
        Allow from all
      </IfModule>
    </FilesMatch>
    
    # but now allow just *certain* necessary files:
    <FilesMatch "(?i).*\.(php|html?|js|css|jpe?g|gif|webp|png|otf|ico|cur|map|eot|svgz?|ttf|woff2?|xml|xsl|csv|txt)$">
      <IfModule mod_authz_core.c>
        Require all granted
      </IfModule>
      <IfModule !mod_authz_core.c>
        Order Allow,Deny
        Allow from all
      </IfModule>
    </FilesMatch>
    
    IndexIgnore */*
    
    <limit POST PUT>
      <IfModule mod_authz_core.c>
        Require all denied
      </IfModule>
      <IfModule !mod_authz_core.c>
        Order Allow,Deny
        Deny from all
      </IfModule>
    </limit>
    
    
    ## NOTE: If you want even greater security to prevent hackers from running scripts in this folder, uncomment the following line (if your hosting company will allow you to use OPTIONS):
    # OPTIONS -Indexes -ExecCGI
    
    
    
    ##################
    ## Optional caching improvements
    ## Requires mod_header and mod_deflate to be enabled within Apache
    ##################
    <IfModule mod_headers.c>
      Header unset Pragma
      FileETag None
      Header unset ETag
      #Header set Cache-Control "no-transform"
      <FilesMatch "(?i).*\.(ico|jpe?g|gif|otf|webp|png|svgz?)$">
        Header set Cache-control "max-age=864000, public, must-revalidate"
        Header unset Last-Modified
      </FilesMatch>
      <FilesMatch "(?i).*\.(html|htm|xml|txt|xsl)$">
        Header set Cache-control "max-age=7200, must-revalidate"
      </FilesMatch>
    </IfModule>
    <IfModule mod_deflate.c>
      <FilesMatch "(?i)\.(js|css)$">
        SetOutputFilter DEFLATE
      </FilesMatch>
    </IfModule>
    
    ##################
    ## Optional improvements
    ## Requires mod_expires to be enabled within Apache
    ##################
    <ifmodule mod_expires.c>
      ExpiresActive On
      ExpiresDefault A300
      ExpiresByType application/x-javascript A3600
      ExpiresByType text/css A3600
      ExpiresByType image/gif A604800
      ExpiresByType application/pdf A604800
      ExpiresByType text/html A300
      ExpiresByType image/x-icon A86400
      ExpiresByType image/jpeg A2592000
      ExpiresByType image/png A2592000
      ExpiresByType text/cache-manifest "access plus 0 seconds"
      ExpiresByType image/svg A2592000
    </ifmodule>
    
    
    #turn off X-PHP-Originating-Script header when sending emails from admin
    #uncomment to activate:
    # php_flag mail.add_x_header Off
    Quote Originally Posted by carlwhat View Post
    also, this looks incorrect:

    Code:
    //what you have
    define('HTTP_SERVER', 'https://shop.MY_DOMAIN');
    define('HTTPS_SERVER', 'https://shop.MY_DOMAIN');
    
    //what it should be
    define('HTTP_SERVER', 'https://shop.MY_DOMAIN.com');
    define('HTTPS_SERVER', 'https://shop.MY_DOMAIN.com');
    best.
    MY_DOMAIN includes the TLD sorry.

  9. #9
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,693
    Plugin Contributions
    9

    Default Re: Subdomains and Subfolders

    remove both .htaccess files from the new site and see if it works...

    if it does, there is your problem.

    but truly this is something your hosting company should be able to help.

    best.
    author of square Webpay.
    mxWorks has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  10. #10
    Join Date
    May 2023
    Location
    Canada
    Posts
    50
    Plugin Contributions
    0

    Default Re: Subdomains and Subfolders

    Quote Originally Posted by carlwhat View Post
    remove both .htaccess files from the new site and see if it works...

    if it does, there is your problem.

    but truly this is something your hosting company should be able to help.

    best.
    I tried that, deleted the cache on Firefox, and tried the URLs and I can still see shop.blah.com but shop.blah.com/MY_ADMIN redirects to blah.com/MY_ADMIN Thanks for your help and suggestions!

    I don't have any redirects set up in cPanel other than the subdomain, but maybe my host has a solution.

 

 

Similar Threads

  1. Install on subdomains and with one shopping cart
    By Aitd001 in forum Installing on a Linux/Unix Server
    Replies: 6
    Last Post: 13 Jun 2011, 03:53 PM
  2. SubDomains and Redirected Domain Names and ZenCart
    By AlyssaKay in forum General Questions
    Replies: 6
    Last Post: 16 Jul 2010, 11:52 AM
  3. Wanted: multilingual integration with SEF and language subdomains
    By johanburrough in forum Installing on a Linux/Unix Server
    Replies: 3
    Last Post: 5 Apr 2010, 07:07 PM
  4. SSL, Subdomains and multiple stores
    By LakeEffect in forum General Questions
    Replies: 1
    Last Post: 20 Aug 2007, 06:54 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR