Post by eisteddfod_37 » Fri Aug 23, 2024 8:09 pm

Good Afternoon,

I've got a strange little issue, and I wondered if anyone had come across this before.

Images won't load, if they're into a 3rd level category (sorry can't remember the terms for URLs).

Example
https://www.class58loco.group/shop

Go down one more category, and all images including the loco don't/won't show.

https://www.class58loco.group/shop/store-books

If you look at the URL for the image, it seems it's pointing to the image directory, just one level above where it's at, not going back to the root. I've never noticed it before and I don't think anything has changed, it just seems to have started doing it.

However if I turn off SEO URLs it work fine. It's really annoying me, as I'm not sure what's causing the issue.

OC version 2.2.0.0

Any help would be greatly appreciated please.

Many thanks

Andy

New member

Posts

Joined
Fri Jul 27, 2018 12:07 am

Post by xxvirusxx » Fri Aug 23, 2024 8:46 pm

Possible wrong config files...or htaccess

Because you have...

Code: Select all

https://www.class58loco.group/shop/image/catalog/C58LG.png
and the correct url is

Code: Select all

https://www.class58loco.group/image/catalog/C58LG.png

Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by eisteddfod_37 » Fri Aug 23, 2024 8:54 pm

First thing I checked. All seems ok.

Config file:

Code: Select all

<?php
// HTTP
define('HTTP', $_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']));
define('HTTP_SERVER', 'http://'.HTTP);
define('HTTP_IMAGE', 'http://'.HTTP.'image/');
define('HTTP_ADMIN', 'http://'.HTTP.'admin/');

// HTTPS
define('HTTPS_SERVER', 'https://'.HTTP);
define('HTTPS_IMAGE', 'https://'.HTTP.'image/');

// DIR
define('DIR_ROOT', dirname(__FILE__));
define('BASE_DIR', realpath(dirname(__FILE__)));
define('DIR_APPLICATION', BASE_DIR.'/catalog/');
define('DIR_SYSTEM', BASE_DIR.'/system/');
define('DIR_LANGUAGE', BASE_DIR.'/catalog/language/');
define('DIR_TEMPLATE', BASE_DIR.'/catalog/view/theme/');
define('DIR_CONFIG', BASE_DIR.'/system/config/');
define('DIR_IMAGE', BASE_DIR.'/image/');
define('DIR_CACHE', BASE_DIR.'/system/storage/cache/');
define('DIR_DOWNLOAD', BASE_DIR.'/system/storage/download/');
define('DIR_LOGS', BASE_DIR.'/system/storage/logs/');
define('DIR_MODIFICATION', BASE_DIR.'/system/storage/modification/');
define('DIR_UPLOAD', BASE_DIR.'/system/storage/upload/');
.htaccess

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


# Prevent Direct Access to files
<FilesMatch "(?i)((\.tpl|\.ini|\.log|(?<!robots)\.txt))">
 Order deny,allow
 Deny from all
</FilesMatch>

RewriteBase /
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

New member

Posts

Joined
Fri Jul 27, 2018 12:07 am

Post by xxvirusxx » Fri Aug 23, 2024 9:07 pm

eisteddfod_37 wrote:
Fri Aug 23, 2024 8:54 pm
// HTTP
define('HTTP', $_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']));
define('HTTP_SERVER', 'http://'.HTTP);
define('HTTP_IMAGE', 'http://'.HTTP.'image/');
define('HTTP_ADMIN', 'http://'.HTTP.'admin/');

// HTTPS
define('HTTPS_SERVER', 'https://'.HTTP);
define('HTTPS_IMAGE', 'https://'.HTTP.'image/');
Who changed like this......??

Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by eisteddfod_37 » Fri Aug 23, 2024 9:33 pm

Is it wrong?

I was looking at the following line.

Code: Select all

define('DIR_IMAGE', BASE_DIR.'/image/');
The website been active for 5 or 6 years, and I'm the only one who has access to it. I don't recall changing it.

New member

Posts

Joined
Fri Jul 27, 2018 12:07 am

Post by xxvirusxx » Fri Aug 23, 2024 9:38 pm

You use oc 1.5... configs on oc 2.2.x website

Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by ADD Creative » Fri Aug 23, 2024 9:49 pm

HTTP_HOST can be set to anything in the request from a client and should not be trusted in that way. Use your actual URL.

www.add-creative.co.uk


Guru Member

Posts

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

Post by eisteddfod_37 » Fri Aug 23, 2024 11:22 pm

I've now updated the config file, by creating a clean install to the following.

However the issue still persists.

Code: Select all

<?php
// HTTP
define('HTTP_SERVER', 'https://class58loco.group/');

// HTTPS
define('HTTPS_SERVER', 'https://class58loco.group/');

// DIR
define('DIR_APPLICATION', '/var/www/vhosts/class58loco.group/httpdocs/catalog/');
define('DIR_SYSTEM', '/var/www/vhosts/class58loco.group/httpdocs/system/');
define('DIR_IMAGE', '/var/www/vhosts/class58loco.group/httpdocs/image/');
define('DIR_LANGUAGE', '/var/www/vhosts/class58loco.group/httpdocs/catalog/language/');
define('DIR_TEMPLATE', '/var/www/vhosts/class58loco.group/httpdocs/catalog/view/theme/');
define('DIR_CONFIG', '/var/www/vhosts/class58loco.group/httpdocs/system/config/');
define('DIR_CACHE', '/var/www/vhosts/class58loco.group/httpdocs/system/storage/cache/');
define('DIR_DOWNLOAD', '/var/www/vhosts/class58loco.group/httpdocs/system/storage/download/');
define('DIR_LOGS', '/var/www/vhosts/class58loco.group/httpdocs/system/storage/logs/');
define('DIR_MODIFICATION', '/var/www/vhosts/class58loco.group/httpdocs/system/storage/modification/');
define('DIR_UPLOAD', '/var/www/vhosts/class58loco.group/httpdocs/system/storage/upload/');

New member

Posts

Joined
Fri Jul 27, 2018 12:07 am

Post by ADD Creative » Sat Aug 24, 2024 12:01 am

Your base href tag in the HTML header looks wrong. You need to work out what is changing it from the OpenCart default.

www.add-creative.co.uk


Guru Member

Posts

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

Users browsing this forum: No registered users and 9 guests