Hi everyone,
I’m working on updating a site from EE2 to EE6, and I’ve figured out how to do this … but one problem I have is that all of the links are absolute URLs as apposed to relative. I need to fix this prior to the update, as the admin page does not work correctly with the update because of this problem I believe.
I’ve checked the template manager section, and was able to change about 5 links, and correctly change the favicon locally to test that it works, but viewing the source code, there are still a lot more to change.
If you have any suggestions, I will happily give them a try. It’s hard to find much information on EE2 now.
Thanks!
I’m not either a browser nerd nor SEO maven, but I strongly suspect that you are better off leaving the links as absolute URLs.
EE will take care of putting the right prefix on the absolute URL if you change between staging and live etc.
The auto-update process is good at migrating from EE2 to EE6. The only situation where you might have issues is if you have added hard-wired copies of EE2 CP urls to your site (rather than letting EE generate these as needed) - in which case you will have to find them and replace them with either updated hard-wired links or EE generated links to the resources you require.
If you want to make it easy then adding base_path and base_url to your config file is an easy way of ensuring that the paths are set correctly on each platform.
HTH
🐾
The main problem with the hardcoded links is that they are written in as http and we are also attempting to switch to https, and when tested, the site no longer works, because all of the paths are hardcoded. Quite a few add-ons also had to be removed for the update, and we also want to check that everything still works/what needs to be replaced before going to the live server, but every click redirects to the live version.
And from my understanding, updating from EE2 to EE6 must be done manually … am I missing something there?
Currently, the htaccess file is set to “deny from all” and I don’t actually have access directly to the files. I know how to change this, but I was wondering if there is a way to fix it directly through the EE admin page (because I’m very new to web development, and currently avoiding changes to the live server lol)
EE 6 now can do automated updates that will bring sites from EE2 up to date. However that will only cover EE’s core files.
If you have EE2 add-ons installed you will certainly need to update those: EE went through fairly big changes between EE2 and EE3, and pre-EE3 add-ons are missing some files that prevent them working with EE3 or later. Not all EE2 add-ons were updated to run in EE3 and beyond, and so you really need to go through each in turn and see what options there are for updating them. Further, some of the add-ons that did update have changed significantly in the period between EE2 and EE6, and this may result in you having to make changes to your templates / tags to accommodate this. Sometimes there is no equivalent to the add-on available for EE6 and you either have to substitute native EE6 mechanisms (which is often possible, since EE6 is much more capable out of the box than EE2), integrate a different add-on into your site’s templates, or rethink how you are approaching the issue being solved by the add-on.
In EE2 you can edit the templates from within the Control Panel - there is a subsection related to Templates (within the Developer menu if I remeber rightly): changes you make there will be reflected immediately on the live site. Because of this, I strongly recommend that you do not work directly on the live site but instead create a ‘staging’ or local copy of the site - work on that until you have completed the update and then load the updated site onto the live server.
You don’t say how complicated the site design is (i.e. how many templates) but you may be able to do the http to https update by opening each template in turn and doing a simple search for http in the tempate code and adding an extra ‘s’ where necessary. However it might be better to understand what actually those links are doing and update them more intelligently - for example replacing hard-coded links to the same EE site with either relative links (which may not work as the links themselves may not be the same in later versions of EE) or EE tags that generate the appropriate links (a better long term solution) - either way you probably need to work through the site template by template.
Almost certainly to update the site to EE6 you will need to get file access to the current live server - the best plan would be to simply copy all the files from the live server to another location, make a copy of the MySQL database that is driving the live site, and set it all up on another host that you can work on to do the update.
EE2->6 updates are not hard to do in and of themselves, what makes the updates more complicated are the modifications made by the EE2 designers - the add-ons included, and whatever weird hacks are included in the templates (such as hard-coded links or inline-php and so on). If you are new to EE it might make sense to see if you can get a budget to get an experienced EE developer to either work with you or to be ‘on call’ to help you resolve the issues you encounter: not strictly necessary, but overall would save you a lot of time and get you a better outcome.
HTH
🐾
So I do have the update figured out (albeit, maually), and I have been working on a local copy instead of the live site. To get a real sense of what the website is like, it’s novasunpower.com (it’s not very complicated).
When I view the source code, I can see all of the links that need to be changed, but in the template manager section there is different code. The About Us page, for example, has this:
{embed="includes/head" default_title="About Us"}
<body>
{embed="includes/navigation"}
<div id=”sb-site”>
{embed="includes/header-sub"}
<section class=”title”> <div class=”container”> {exp:channel:entries channel="about_us" limit="1"} <h1>{channel_title}</h1> {/exp:channel:entries} </div> </section>
<div class=”container row gutters”>
<div class=”col sub-text span_4”> {exp:channel:entries channel="about_us" limit="1"} {profile_photo} {/exp:channel:entries} </div>
<div class=”col sub-text span_7”>
{exp:channel:entries channel="about_us" limit="1"} {content} {/exp:channel:entries}
</div>
</div>
{embed="includes/testimonials"}
{embed="includes/footer"}
<!–Close Site–> </div>
{embed="includes/close"}
As you can tell, this doesn’t show any of the links that need to be changed. I’m just wondering where exactly I can find the links to change them. You also mentioned tags, and if you could explain that a little more and how I would go about it, that would be amazing.
As far as hiring someone else to do it, I’m actually a student working for a summer job, where it was known that I knew nothing about this, however support for me is limited at the moment. I’m learning on the job, and can’t hire someone else to do it for me haha.
OK - so you are probably closer to a solution than you realise.
The code you see in the template manager version of the pages are examples of the native EE tags. In the code example you pasted none of the tags actually generates an URL - they all relate exclusively to either accessing EE content or running other templates from within your site to add to the content of the page. My guess is that some of the other templates referred to are the ones either containing the hard-coded URLs or generating them via other EE tags.
Separately, if that is typical of the site design you are working with, the design is quite inefficient / poor: the three identical channel:entries tags are unnecessary and will slow down processing - you could replace them with this for example:
{exp:channel:entries channel="about_us" limit="1"}
<section class=”title”>
<div class=”container”>
<h1>{channel_title}</h1>
</div>
</section>
<div class=”container row gutters”>
<div class=”col sub-text span_4”>{profile_photo}</div>
<div class=”col sub-text span_7”>
{content}
</div>
</div>
{/exp:channel:entries}
This is because each time you have a channel:entries
tag in your template there is a processing cost for EE (to load up the code needed to get the data) - since you already have the data from the first call, you can simply not make the second two and your output will be the same with less effort involved.
Likewise {embed}
calls are quite resource intensive - there are usually other methods available that often achieve the same result without the processing cost. For example, the tag {embed="includes/testimonials"}
tells EE to go and find the template called testimonials
in the group includes
, set up a new copy of EE’s template engine to process it, process it, and insert the output into the template when it is processed. Since there is no data being passed from your template to the embedded template it is quite likely that you could simply insert the template code from testimonials
into your template and process all the template instructions at once. Sometimes this kind of structure is used to allow code to be reused, but EE has other more efficient ways of doing this (via the ‘Template Partials’ system) that almost always is good enough. There are some circumstances where an embed
call is required, but they are relatively uncommon.
Anyhow - the fact that those EE tags are different from your ‘source’ suggests that you are looking at the Browser “View Source” option to get your information: the purpose of EE’s template system is to generate HTML output that a browser can read, so that suggests that something is working right at least!
It would be worth checking before you get too deep into the woods that in your local / test system you have updated the settings for the site - the main settings page will have a link to “URL and path settings” or similar where you can specify what the URL for your site is (and the path to the site files) - if this has not been updated it will still be adding in the ‘live site’ path to any URLs generated by the site: change this to the base URL used by your test site (and included https in it) and you should be in a better place.
HTH
🐾
That’s so interesting for your help, JCOGS Design. Thanks a lot. I’m ready to try avatar game.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.