A common SEO and usability problem in OpenCart-based online stores when there is a need to disable or remove the English (or any other) language version of the site. Usually, after disabling a language in the admin panel, all old URLs that have already been indexed by search engines (for example, Google) start returning a 404 error (Page not found). This negatively affects user behavior factors and reduces the site's position in search results.
If your site used a clear language prefix in links (for example, redirecting from /en/ to the homepage or to old Russian pages like /ru/), and the URL structure (SEO URL) is identical in this case — such a task can and should be solved at the server level through the .htaccess file
# Redirect from /en/ or /en to the homepage
RewriteCond %{REQUEST_URI} ^/en/?$ [NC,OR]
RewriteCond %{REQUEST_URI} ^/en/(.*)$ [NC]
RewriteRule ^(.*)$ https://%{HTTP_HOST}/ [R=301,L]
Your case, if the links on the site went without a language prefix, and SeoPro is enabled in the store settings
The modifier automatically intercepts requests to the disabled language version and implements a correct 301 redirect (Moved Permanently) to the base (Ukrainian) localization of the site with full preservation of the URL structure (if the page exists).
In the current code of the modifier, language ID 2 is set by default, which corresponds to Ukrainian localization on the test and most standard sites.
<?xml version="1.0" encoding="utf-8"?>
<modification>
<name>EN redir to UKR</name>
<code>EN redir to UKR</code>
<version>1.0</version>
<author>kJlukOo</author>
<link>https://cleanphp.pp.ua</link>
<file path="system/library/seopro.php">
<operation>
<search><![CDATA[public function prepareRoute($parts) {]]></search>
<add position="before"><![CDATA[
function enRedirToUkr($keyword)
{
$query_string = $this->getQueryByKeyword($keyword, 2);
if ($query_string) {
$url_data = explode('=', $query_string);
if (count($url_data) == 2) {
$route_type = $url_data[0]; // 'information_id', 'product_id' и т.д.
$route_id = $url_data[1];
$route = '';
if ($route_type == 'product_id') {
$route = 'product/product';
} elseif ($route_type == 'category_id') {
$route = 'product/category';
} elseif ($route_type == 'manufacturer_id') {
$route = 'product/manufacturer/info';
} elseif ($route_type == 'information_id') {
$route = 'information/information';
}
if ($route) {
$new_url = $this->url->link($route, $route_type . '=' . (int)$route_id);
$this->response->redirect($new_url, 301);
}
}
}
}
]]></add>
</operation>
</file>
<file path="system/library/seopro.php">
<operation>
<search><![CDATA[$query = $this->getQueryByKeyword($parts[$id]);]]></search>
<add position="after"><![CDATA[
if(!$query)
$this->enRedirToUkr($parts[$id]);
]]></add>
</operation>
</file>
</modification>