How to remove en-gb from the SEO URL of Opencart 4?

In Opencart 4, when we activate the SEO URL it contains the language as well and for the English language, it shows en-gb by default, which we don’t like so we looked to remove it and the easiest way to remove en-gb is by following code. The following code will not work if you have multiple languages, it works only for English because we are replacing en-gb from the URL, we will find a way soon to remove all the languages and post the solution here.

SEO best practices for Opencart 4

Open file /system/library/url.php and find the following code:

if (!$js) {
	return str_replace('&', '&', $url);
} else {
	return $url;

And, replace with the following code:

if (!$js) {
	return str_replace('en-gb/', '', str_replace('&', '&', $url));
} else {
	return str_replace('en-gb/', '',$url);

Speed up the Opencart 

This will remove the en-gb from the Opencart 4 URL. Please let us know if you have any questions or suggestions, please subscribe to our YouTube Channel for Opencart video tutorials and you can see more in the Opencart tutorial category. You can also find us on Twitter and Facebook. Enjoy!


Please enter your comment!
Please enter your name here