Nginx rewrite help for CubeCart

Discussion in 'General' started by bobbymagoo, Apr 25, 2019.

  1. bobbymagoo

    bobbymagoo New Member

    Hi,
    Are there any nginx vhost directives available for CubeCart please?
    Although installs perfectly fine none of the links work as they are missing the rewrite of index.php?seo_path=
    CubeCart creates its own .htaccess file but I am running nginx on this server!
    (Perfect Server Setup Debian 9 (Nginx, BIND, Dovecot, ISPConfig 3.1)

    Heres the .htaccess incase anyone can help

    HTML:
    ##### START CubeCart .htaccess #####
    
    ### GZIP Compression ###
    <ifmodule mod_deflate.c>
        AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript
    </ifmodule>
    
    ### Files Expiration ###
    <IfModule mod_expires.c>
        ExpiresActive On
        ExpiresByType text/html "access 0 seconds"
        ExpiresDefault "access 7 days"
    </IfModule>
    
    ### File Security ###
    <FilesMatch "\.(htaccess)$">
      Order Allow,Deny
      Deny from all
    </FilesMatch>
    
    ### Apache directory listing rules ###
    DirectoryIndex index.php index.htm index.html
    IndexIgnore *
    
    <ifModule mod_headers.c>
      Header always append X-Frame-Options SAMEORIGIN
    </ifModule>
    
    ### Rewrite rules for SEO functionality ###
    <IfModule mod_rewrite.c>
      RewriteEngine On
      RewriteBase /shop/
    
      ##### START v4 SEO URL BACKWARD COMPATIBILITY #####
      RewriteCond %{QUERY_STRING} (.*)$
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteRule cat_([0-9]+)(\.[a-z]{3,4})?(.*)$ index.php?_a=category&cat_id=$1&%1 [NC]
    
      RewriteCond %{QUERY_STRING} (.*)$
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteRule prod_([0-9]+)(\.[a-z]{3,4})?$ index.php?_a=product&product_id=$1&%1 [NC]
    
      RewriteCond %{QUERY_STRING} (.*)$
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteRule info_([0-9]+)(\.[a-z]{3,4})?$ index.php?_a=document&doc_id=$1&%1 [NC]
    
      RewriteCond %{QUERY_STRING} (.*)$
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteRule tell_([0-9]+)(\.[a-z]{3,4})?$ index.php?_a=product&product_id=$1&%1 [NC]
    
      RewriteCond %{QUERY_STRING} (.*)$
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteRule _saleItems(\.[a-z]+)?(\?.*)?$ index.php?_a=saleitems&%1 [NC,L]
      ##### END v4 SEO URL BACKWARD COMPATIBILITY #####
    
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond %{REQUEST_URI} !=/favicon.ico
      RewriteRule ^(.*)\.html?$ index.php?seo_path=$1 [L,QSA]
    </IfModule>
    
    ### Default store 404 page ###
    ErrorDocument 404 /shop/index.php
    
    ## Override default 404 error document for missing page resources ##
    <FilesMatch "\.(gif|jpe?g|png|ico|css|js|svg)$">
      ErrorDocument 404 "<html></html>
    </FilesMatch>
    ##### END CubeCart .htaccess #####
    Thanks in advance
     
    Last edited: Apr 25, 2019
  2. Jesse Norell

    Jesse Norell ISPConfig Developer Staff Member ISPConfig Developer

Share This Page