Post by SScott » Mon Jun 21, 2021 10:54 pm

Hello and thank you in advance. I have a test cart setup (3.0.3.7) to make sure it works before upgrading a live site. Everything is work except the SEO Url for the products. The cat pages and all others are fine but if you click on a single product it goes into a very long wait and the refreshes to the old style.

For example:
If I click a link to go to:
.com/BALPHA.html/H-ABKM-A
It will take minutes and eventually go to:
.com/index.php?_route_=BALPHA.html/H-ABKM-A

I have made sure line 87 of seo_url.php is correct:

Code: Select all

} elseif ($key == 'route') {
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "seo_url WHERE `query` = '" . $this->db->escape($value) . "' AND store_id = '" . (int)$this->config->get('config_store_id') . "' AND language_id = '" . (int)$this->config->get('config_language_id') . "'");
if ($query->num_rows && $query->row['keyword']) {
$url .= '/' . $query->row['keyword'];
unset($data[$key]);
} else if ($data['route'] == "common/home") {
$url .= '/';
}
I have removed every extension. I tried creating a product in the cart admin instead of importing and all to no avail.

I have tried many variations of the .htaccess file. I am currently using this on other sites (Similar) and it seems to work. Here is the latest version I am attempting:

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

# Remove trailing slash from non-filepath urls
RewriteCond %{REQUEST_URI} /(.+)/$
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ https://www.X.com/%1 [R=301,L]

# Include trailing slash on directory 
RewriteCond %{REQUEST_URI} !(.+)/$
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.+)$ https://www.X.com/$1/ [R=301,L]

# Force HTTPS and WWW 
RewriteCond %{HTTP_HOST} !^www\.(.*)$ [OR,NC]
RewriteCond %{https} off  
RewriteRule ^(.*)$ https://www.X.com/$1 [R=301,L]

#RewriteCond %{SERVER_PORT} 80
#RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]
#RewriteCond %{HTTP_HOST} !^www\.
#RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]

#RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$
#RewriteRule ^(.*)$ https://www.%1%{REQUEST_URI} [R=301,L]

#Redirect /index.php?coupon=THISISMADEUP /index.php?route=checkout/cart

#This mod is for the customers using the return option in history
RewriteCond %{QUERY_STRING}  ^route=account/return [NC]
RewriteRule ^index.php?$ /returns.html? [L,R=301]

### 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
#Redirect /admin/view/javascript/summernote/summernote.js /admin/view/javascript/ckeditor/ckeditor.js
#Redirect /admin/view/javascript/summernote/opencart.js /admin/view/javascript/ckeditor/opencart.js
#Redirect /admin/view/javascript/summernote/summernote.css /admin/view/javascript/ckeditor/summernote.css

# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php74” package as the default “PHP” programming language.
<IfModule mime_module>
  AddHandler application/x-httpd-ea-php74 .php .php7 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit

Anyone have any other ideas to try?

Thanks again!

Newbie

Posts

Joined
Wed Mar 26, 2014 9:19 pm

Post by paulfeakins » Tue Jun 22, 2021 6:31 pm

SScott wrote:
Mon Jun 21, 2021 10:54 pm
Anyone have any other ideas to try?
Try a fresh .htaccess perhaps from github?

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Guru Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom

Post by SScott » Tue Jun 22, 2021 9:28 pm

Thank you sir.

I have found it was for sure something I did. My first attempt was a new .htaccess file then I disabled every module I installed, some of which are just small ocmods I made. I think disabling them must have not actual stopped what was happening. I installed the same OC version on a another website fresh, then imported all the same cats and prods and no other ocmods and it runs fast and perfect. So I plan on installing one module at a time to see which one is breaking it. After I find it, I will update this.
paulfeakins wrote:
Tue Jun 22, 2021 6:31 pm
SScott wrote:
Mon Jun 21, 2021 10:54 pm
Anyone have any other ideas to try?
Try a fresh .htaccess perhaps from github?

Newbie

Posts

Joined
Wed Mar 26, 2014 9:19 pm
Who is online

Users browsing this forum: No registered users and 91 guests