Running test opencart site on subdirectory - not all pages route correctly
Posted: Tue Jan 09, 2018 2:06 am
I am sure this is a simple thing I am missing from spending too much time looking at it.
I am running version 1.5.6.4
I have my live site running from the root directory. I have set up a subdirectory called "oc2" to do some testing on a new template before going live on the production site. Most things appear to be OK, but there are a few links that still point back to the main site, not the subdirectory. My question is, what am I doing wrong in my .htaccess or config files that would cause this?
As an example, in the footer the "About us" link is as follows:
<a href="../index.php?route=information/information&information_id=4">
When a user clicks on the "About us" link the "about us" from the main site gets loaded, not the "about us" from the subdirectory
My .htaccess on the subdirectory is as follows:
Thanks very much for your insight...
I am running version 1.5.6.4
I have my live site running from the root directory. I have set up a subdirectory called "oc2" to do some testing on a new template before going live on the production site. Most things appear to be OK, but there are a few links that still point back to the main site, not the subdirectory. My question is, what am I doing wrong in my .htaccess or config files that would cause this?
As an example, in the footer the "About us" link is as follows:
<a href="../index.php?route=information/information&information_id=4">
When a user clicks on the "About us" link the "about us" from the main site gets loaded, not the "about us" from the subdirectory
My .htaccess on the subdirectory is as follows:
My config file in the /oc2 directory is:# 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 Directoy listing
Options -Indexes
# Prevent Direct Access to files
<FilesMatch "(?i)((\.tpl|\.ini|\.log|(?<!robots)\.txt))">
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 /oc2/
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteRule ^system/download/(.*) 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]
### 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
My config file in the /oc2/admin directory is:<?php
// HTTP
define('HTTP_SERVER', 'http://www.example.com/oc2/');
define('HTTP_IMAGE', 'http://www.example.com/oc2/image/');
define('HTTP_ADMIN', 'http://www.example.com/oc2/admin/');
// HTTPS
define('HTTPS_SERVER', 'https://www.example.com/oc2/');
define('HTTPS_IMAGE', 'https://www.example.com/oc2/image/');
// DIR
define('DIR_APPLICATION', '/home/pump1080/public_html/oc2/catalog/');
define('DIR_SYSTEM', '/home/pump1080/public_html/oc2/system/');
define('DIR_DATABASE', '/home/pump1080/public_html/oc2/system/database/');
define('DIR_LANGUAGE', '/home/pump1080/public_html/oc2/catalog/language/');
define('DIR_TEMPLATE', '/home/pump1080/public_html/oc2/catalog/view/theme/');
define('DIR_CONFIG', '/home/pump1080/public_html/oc2/system/config/');
define('DIR_IMAGE', '/home/pump1080/public_html/oc2/image/');
define('DIR_CACHE', '/home/pump1080/public_html/oc2/system/cache/');
define('DIR_DOWNLOAD', '/home/pump1080/public_html/oc2/download/');
define('DIR_LOGS', '/home/pump1080/public_html/oc2/system/logs/');
// DB
define('DB_DRIVER', 'mysql');
define('DB_HOSTNAME', 'localhost');
define('DB_USERNAME', 'pump1080_xxx');
define('DB_PASSWORD', 'Pumpxxx');
define('DB_DATABASE', 'pump1080_xxx');
define('DB_PREFIX', '');
?>
Any thoughts of what I have done wrong or need to change??<?php
// HTTP
define('HTTP_SERVER', 'http://www.example.com/oc2/admin/');
define('HTTP_CATALOG', 'http://www.example.com/oc2/');
define('HTTP_IMAGE', 'http://www.example.com/oc2/image/');
// HTTPS
define('HTTPS_SERVER', 'https://www.example.com/oc2/admin/');
define('HTTPS_CATALOG', 'https://www.example.com/oc2/');
define('HTTPS_IMAGE', 'https://www.example.com/oc2/image/');
// DIR
define('DIR_APPLICATION', '/home/pump1080/public_html/oc2/admin/');
define('DIR_SYSTEM', '/home/pump1080/public_html/oc2/system/');
define('DIR_DATABASE', '/home/pump1080/public_html/oc2/system/database/');
define('DIR_LANGUAGE', '/home/pump1080/public_html/oc2/admin/language/');
define('DIR_TEMPLATE', '/home/pump1080/public_html/oc2/admin/view/template/');
define('DIR_CONFIG', '/home/pump1080/public_html/oc2/system/config/');
define('DIR_IMAGE', '/home/pump1080/public_html/oc2/image/');
define('DIR_CACHE', '/home/pump1080/public_html/oc2/system/cache/');
define('DIR_DOWNLOAD', '/home/pump1080/public_html/oc2/download/');
define('DIR_LOGS', '/home/pump1080/public_html/oc2/system/logs/');
define('DIR_CATALOG', '/home/pump1080/public_html/oc2/catalog/');
// DB
define('DB_DRIVER', 'mysql');
define('DB_HOSTNAME', 'localhost');
define('DB_USERNAME', 'pump1080_xxx');
define('DB_PASSWORD', 'Pumpxxx');
define('DB_DATABASE', 'pump1080_xxx');
define('DB_PREFIX', '');
?>
Thanks very much for your insight...