How to improve a website speed when using xLanguage

From time to time, we use xLanguage in WordPress. It’s simple and works well. We just found a small problem with the permalinks, forcing the client browser to redirect with every click on a page. For example, instead of “/lang/es/about-me” you have to go to “/lang/es/about-me/”. This does not make any sense, and it certainly makes websites slower.

xLanguage modifies the WordPress link logic, so adding a slash after everything looks like a simple solution. Edit wp-content/plugins/xlanguage/xlanguage.php and in lines 928-930 add a slash (/) at the end. Like this:

if (strpos($url, $pre) === 0) {
                return untrailingslashit(substr($url, 0, strlen($pre)) . '/' . xLanguageTagPermalink . '/' . $lang . substr($url, strlen($pre))) . '/';
            } else return $url;

Of course, there is a lot more to do to improve a website response. You should:

  • Use gzip in Apache (mod_deflate)
  • Combine your CSS and JS
  • Make sure you load the CSS first
  • Use PHP caching (php-apc)
  • Use WordPress caching (something like wp-super-cache).

Try this with Firebug or Chrome developer panel and you’ll see a huge difference!

Post a comment.