The online store is based on OC 2.2.0.0. The site has ssl installed and implemented correctly on all levels.
The problem is that the links to categories in the dropdown menus in the head, remain http:// which successfuly redirects with a 301 to the https:// version upon click.
This isnt't the best way to go in terms of SEO, so my goal is to simply change the links to https:// and have a 200 response code for all internal links.
The code that pulls the links and sets them up in the dropdown menu is:
<nav id="menu" class="navbar"> <!-- add class name as 'mega-menu'
LIKE class="mega-menu" -->
<div class="navbar-header collapsed" data-toggle="collapse" data-
target=".navbar-ex1-collapse"><span id="category" class="visible-xs"><?php echo $text_category; ?></span>
</div>
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav">
<?php //print_r($categories); ?>
<?php foreach ($categories as $category) { ?>
<?php if ($category['children']) { ?>
<li class="dropdown"><a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a>
<div class="dropdown-menu">
<div class="dropdown-inner">
<?php foreach (array_chunk($category['children'], ceil(count($category['children']) / $category['column'])) as $children) { ?>
<ul class="list-unstyled childs_1 <?php if($category['column']<=1) echo 'single-dropdown-menu'; else echo 'mega-dropdown-menu'; ?>">
<?php foreach ($children as $child) { ?>
<!-- 2 Level Sub Categories START -->
<?php if ($child['childs']) { ?>
<li class="dropdown"><a href="<?php echo $child['href']; ?>"><?php echo $child['name']; ?></a>
<div class="dropdown-menu">
<div class="dropdown-inner">
<?php foreach (array_chunk($child['childs'], ceil(count($child['childs']) / $child['column'])) as $childs_col) { ?>
<ul class="list-unstyled childs_2">
<?php foreach ($childs_col as $childs_2) { ?>
<li><a href="<?php echo $childs_2['href']; ?>"><?php echo $childs_2['name']; ?></a></li>
<?php } ?>
</ul>
<?php } ?>
</div>
</div>
</li>
<?php } else { ?>
<li><a href="<?php echo $child['href']; ?>"><?php echo $child['name']; ?></a></li>
<?php } ?>
<!-- 2 Level Sub Categories END -->
Is there a way to rewrite all internal links to begin with https:// instead of http://
There is no such option in the admin area of OC.
As far as I can see the store uses a custom theme.
I can provide any code if needed.
Thanks in advance!
A properly coded theme should pick this up from the config files, of which there are 2 in OpenCart:
Replace all instances of http with https in there, clear all caches and try again.
If that doesn't work it means your theme is badly coded but all is not lost, you can replace "http://" in all files in the theme folder with any good IDE (Notepad++ for one will do this, I use an IDE called Kate which is excellent and does this).
Your theme folder will be at:
You can replace "http://" with "https://" or, if you may want to switch back to http in future, you could replace "http://" with just "//" which tells the browser to use the same protocol as the current page and is therefore more flexible and dynamic.