Post by rale » Sun Apr 17, 2016 2:22 am

I install ssl and turn on seo url. Now have problem, when click on category all work fine, but then click on subcategory or product (just that route not from product on home page), css and picture not work. I try all, define image folder, change on header url to directories, javasript, css everything, (on that way just work css on subcategory) but still have problem.
Visit this link: nadohvatruke.rs/odeca and after that choose subcategory or product. First level url category work good, other levels /odeca/za-muskarce/etc not work properly, also can not add to checkout product from subcategory or product from route subcategy. I dont know what happend. When seo url turn off, all work fine.
???
If someone know what problem, please answer.
Last edited by rale on Mon Jun 03, 2019 6:29 pm, edited 1 time in total.

User avatar
New member

Posts

Joined
Sun Apr 17, 2016 1:44 am

Post by oc-extensions » Sun Apr 17, 2016 7:40 am

Hi,

Just checked your store few minutes ago and doesn't seems SEO URL option enabled in admin area.

Use default opencart SEO or some custom extension?

How look your .htaccess file?

Image | Extensions and Custom Development


User avatar
Active Member

Posts

Joined
Fri Jan 06, 2012 11:31 pm

Post by rale » Sun Apr 17, 2016 9:32 pm

Thank you for answer oc-extensions. I turn off seo url becouse cant work properly. I can turn on for checked and go to do right now.
Use default open cart seo.
I have some seo extension From open cart Brasil but not use for now, is disabled.
This is all from htacces:
I add just redirect from https and home page route seo for adress.

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 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/
# redirect rules first

RewriteEngine On
#RewriteBase /

#This setting force logo url to it's home page
RewriteCond %{QUERY_STRING} ^route=common/home$
RewriteRule ^index\.php$ https://www.nadohvatruke.rs/? [R=301,L,NE,NC]

#This setting force http to https version
RewriteCond %{SERVER_PORT} 80

RewriteRule ^(.*)$ https://www.nadohvatruke.rs/$1 [R=301,L,NE]
#RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
#RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteRule ^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
Seo url turn on, you can check now how work. please use category , subcategory and product from categorz and home page. Just work one level on adress nadohvatruke.rs/odeca but not nadohvatrukers/odeca/zenska-odeca, and work fine if use like this nadohvatruke.rs/zenska-odeca, also product, just if use first level of adress. I dont know why work that. If need more info just say.

User avatar
New member

Posts

Joined
Sun Apr 17, 2016 1:44 am

Post by paulfeakins » Mon Apr 18, 2016 7:22 pm

rale wrote:when click on category all work fine, but then click on subcategory or product (just that route not from product on home page), css and picture not work
I think you still have some hardcoded HTTP links. You need to change these to HTTPS. It could be in your .tpl files, or in .css or maybe even a vQmod.

Usually I change /config.php and /admin/config.php so that all pages are HTTPS.

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 rale » Fri Apr 22, 2016 7:09 pm

Thank you Paul for answer, i alrready change every from http to https on config pages. Maybe i jump or mising some part, not shore, but i will check again.

User avatar
New member

Posts

Joined
Sun Apr 17, 2016 1:44 am

Post by rale » Mon May 02, 2016 10:02 pm

That with seo url with ssl is fixed. That problem is setup from catalog/controller/common/header.php line 29
i change
$data['base'] = $server;
and set this $data['base'] = "//nadohvatruke.rs/";
Now work good, but have some little problems with fa fa icons, not show that.
"Font from origin 'https://nadohvatruke.rs' has been blocked from loading by Cross-Origin Resource Sharing policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://www.nadohvatruke.rs' is therefore not allowed access." This is text from google chrome viewer.

Can you tell me what need to do fopr this ?

User avatar
New member

Posts

Joined
Sun Apr 17, 2016 1:44 am

Post by rale » Tue May 03, 2016 4:30 am

Now all work fine.
This is all what need for seo url with ssl on catalog/controller/common/header.php

Code: Select all

<?php
class ControllerCommonHeader extends Controller {
	public function index() {
		// Analytics
		$this->load->model('extension/extension');

		$data['analytics'] = array();

		$analytics = $this->model_extension_extension->getExtensions('analytics');

		foreach ($analytics as $analytic) {
			if ($this->config->get($analytic['code'] . '_status')) {
				$data['analytics'][] = $this->load->controller('analytics/' . $analytic['code'], $this->config->get($analytic['code'] . '_status'));
			}
		}

		if ($this->request->server['HTTPS']) {
			$server = $this->config->get('config_ssl');
		} else {
			$server = $this->config->get('config_url');
		}

		if (is_file(DIR_IMAGE . $this->config->get('config_icon'))) {
			$this->document->addLink("//www.nadohvatruke.rs/" . 'image/' . $this->config->get('config_icon'), 'icon');
		}

		$data['title'] = $this->document->getTitle();

		$data['base'] = "//www.nadohvatruke.rs/";
		$data['description'] = $this->document->getDescription();
		$data['keywords'] = $this->document->getKeywords();
		$data['links'] = $this->document->getLinks();
		$data['styles'] = $this->document->getStyles();
		$data['scripts'] = $this->document->getScripts();
		$data['lang'] = $this->language->get('code');
		$data['direction'] = $this->language->get('direction');

		$data['name'] = $this->config->get('config_name');

		if (is_file(DIR_IMAGE . $this->config->get('config_logo'))) {
			$data['logo'] = "//www.nadohvatruke.rs/" . 'image/' . $this->config->get('config_logo');
		} else {
			$data['logo'] = '';
		}

		$this->load->language('common/header');

		$data['text_home'] = $this->language->get('text_home');

		// Wishlist
		if ($this->customer->isLogged()) {
			$this->load->model('account/wishlist');

			$data['text_wishlist'] = sprintf($this->language->get('text_wishlist'), $this->model_account_wishlist->getTotalWishlist());
		} else {
			$data['text_wishlist'] = sprintf($this->language->get('text_wishlist'), (isset($this->session->data['wishlist']) ? count($this->session->data['wishlist']) : 0));
		}

		$data['text_shopping_cart'] = $this->language->get('text_shopping_cart');
		$data['text_logged'] = sprintf($this->language->get('text_logged'), $this->url->link('account/account', '', true), $this->customer->getFirstName(), $this->url->link('account/logout', '', true));

		$data['text_account'] = $this->language->get('text_account');
		$data['text_register'] = $this->language->get('text_register');
		$data['text_login'] = $this->language->get('text_login');
		$data['text_order'] = $this->language->get('text_order');
		$data['text_transaction'] = $this->language->get('text_transaction');
		$data['text_download'] = $this->language->get('text_download');
		$data['text_logout'] = $this->language->get('text_logout');
		$data['text_checkout'] = $this->language->get('text_checkout');
		$data['text_category'] = $this->language->get('text_category');
		$data['text_all'] = $this->language->get('text_all');

		$data['home'] = $this->url->link('common/home');
		$data['wishlist'] = $this->url->link('account/wishlist', '', true);
		$data['logged'] = $this->customer->isLogged();
		$data['account'] = $this->url->link('account/account', '', true);
		$data['register'] = $this->url->link('account/register', '', true);
		$data['login'] = $this->url->link('account/login', '', true);
		$data['order'] = $this->url->link('account/order', '', true);
		$data['transaction'] = $this->url->link('account/transaction', '', true);
		$data['download'] = $this->url->link('account/download', '', true);
		$data['logout'] = $this->url->link('account/logout', '', true);
		$data['shopping_cart'] = $this->url->link('checkout/cart');
		$data['checkout'] = $this->url->link('checkout/checkout', '', true);
		$data['contact'] = $this->url->link('information/contact');
		$data['telephone'] = $this->config->get('config_telephone');

		// Menu
		$this->load->model('catalog/category');

		$this->load->model('catalog/product');

		$data['categories'] = array();

		$categories = $this->model_catalog_category->getCategories(0);

		foreach ($categories as $category) {
			if ($category['top']) {
				// Level 2
				$children_data = array();

				$children = $this->model_catalog_category->getCategories($category['category_id']);

				foreach ($children as $child) {
					$filter_data = array(
						'filter_category_id'  => $child['category_id'],
						'filter_sub_category' => true
					);

					$children_data[] = array(
						'name'  => $child['name'] . ($this->config->get('config_product_count') ? ' (' . $this->model_catalog_product->getTotalProducts($filter_data) . ')' : ''),
						'href'  => $this->url->link('product/category', 'path=' . $category['category_id'] . '_' . $child['category_id'])
					);
				}

				// Level 1
				$data['categories'][] = array(
					'name'     => $category['name'],
					'children' => $children_data,
					'column'   => $category['column'] ? $category['column'] : 1,
					'href'     => $this->url->link('product/category', 'path=' . $category['category_id'])
				);
			}
		}

		$data['language'] = $this->load->controller('common/language');
		$data['currency'] = $this->load->controller('common/currency');
		$data['search'] = $this->load->controller('common/search');
		$data['cart'] = $this->load->controller('common/cart');

		// For page specific css
		if (isset($this->request->get['route'])) {
			if (isset($this->request->get['product_id'])) {
				$class = '-' . $this->request->get['product_id'];
			} elseif (isset($this->request->get['path'])) {
				$class = '-' . $this->request->get['path'];
			} elseif (isset($this->request->get['manufacturer_id'])) {
				$class = '-' . $this->request->get['manufacturer_id'];
			} elseif (isset($this->request->get['information_id'])) {
				$class = '-' . $this->request->get['information_id'];
			} else {
				$class = '';
			}

			$data['class'] = str_replace('/', '-', $this->request->get['route']) . $class;
		} else {
			$data['class'] = 'common-home';
		}

		return $this->load->view('common/header', $data);
	}
}

Just need domain adress instead $server
I've tried so far all sorts of things, and this is the only cure. Only three items changed and everything is working properly.

User avatar
New member

Posts

Joined
Sun Apr 17, 2016 1:44 am

Post by gjburg » Wed Jul 06, 2016 7:31 pm

Thanks! This worked for me and another bug solved.

I've waited 3 months with 2.2, assuming that most minor bugs would be solved but ran from major bug into major bug, Opencart should not have released this update for production :(

This is solved now and hopefully I can put my site live now with 2.2.


rale wrote:That with seo url with ssl is fixed. That problem is setup from catalog/controller/common/header.php line 29
i change
$data['base'] = $server;
and set this $data['base'] = "//nadohvatruke.rs/";
Now work good, but have some little problems with fa fa icons, not show that.
"Font from origin 'https://nadohvatruke.rs' has been blocked from loading by Cross-Origin Resource Sharing policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://www.nadohvatruke.rs' is therefore not allowed access." This is text from google chrome viewer.

Can you tell me what need to do fopr this ?

Newbie

Posts

Joined
Wed Jan 21, 2015 5:02 am

Post by gerstavros » Sat Apr 15, 2017 1:02 am

rale wrote:
Tue May 03, 2016 4:30 am
Now all work fine.
This is all what need for seo url with ssl on catalog/controller/common/header.php
[...]
Just need domain adress instead $server
I've tried so far all sorts of things, and this is the only cure. Only three items changed and everything is working properly.
this doesn't fix the problem for me with 2.2

New member

Posts

Joined
Mon Apr 04, 2016 12:44 am

Post by saicastdeal » Thu Jun 01, 2017 6:55 pm

Hello,
Thanks for your post and it really helps to me now ssl work fine except checkout page. When we go to checkout page (http://www.castdeal.com/index.php?route ... t/checkout) then it is only showing "http://" why is it happen when all the pages working fine.

Kindly share your comment

Newbie

Posts

Joined
Thu Jun 01, 2017 6:44 pm

Post by worcesterwebstudio » Thu Jun 08, 2017 8:52 pm

gerstavros wrote:
Sat Apr 15, 2017 1:02 am
rale wrote:
Tue May 03, 2016 4:30 am
Now all work fine.
This is all what need for seo url with ssl on catalog/controller/common/header.php
[...]
Just need domain adress instead $server
I've tried so far all sorts of things, and this is the only cure. Only three items changed and everything is working properly.
this doesn't fix the problem for me with 2.2
Try hardcoding your URL with the https part on line 29:

Code: Select all

$data['base'] = "https://www.mywebsite.com/";


Posts

Joined
Mon Feb 13, 2017 11:15 pm

Post by ndim_pro » Thu Nov 09, 2017 7:32 pm

As this issue really did frustrate me for very long, I will post the solution.

On catalog/controller/common/header.php on line 27
change
$data['base'] = $server;
to
$data['base'] = $server . '/';

AND

on system/library/url.php line 14
change
$secure = false to $secure = true
and on line 18 change
'http://' to 'https://'

User avatar
New member

Posts

Joined
Fri Nov 04, 2016 4:49 pm
Location - Thessaloniki, Greece

Post by barnettgs » Wed May 13, 2020 7:16 pm

ndim_pro wrote:
Thu Nov 09, 2017 7:32 pm
As this issue really did frustrate me for very long, I will post the solution.

On catalog/controller/common/header.php on line 27
change
$data['base'] = $server;
to
$data['base'] = $server . '/';

AND

on system/library/url.php line 14
change
$secure = false to $secure = true
and on line 18 change
'http://' to 'https://'
BRAVO!! ;D

Your solution has fixed my problem. So clearly, it was not my setup problem.

New member
Online

Posts

Joined
Thu Sep 16, 2010 3:01 am
Who is online

Users browsing this forum: No registered users and 48 guests