Welcome Content

Looking for your first paid client? I’ll show how

Optimize xenForo For Less Server Load and Better User Experience

XenForo is my favorite software for building communities and all my communities has moved over from vBulletin to xenForo.

XenForo usage is growing because of its built-in SEO features, responsive and modern design, very active development and growing community with numerous available add-ons.

One of my clients had issues with too many server errors in the logs. So he wanted me to look at them as well as improve the overall experience of the forum for a better user experience.

Once I went through them, found that mostly it was because of some common configuration that can improve the performance of any xenForo forums.

How to Optimize xenForo?

XenForo can be resource heavy if you have too many addons installed with a lot of activity by members.

Here are 10 tips to make your xenForo forums run smoothly with optimal server performance to provide a better user experience and eradicate errors.


Chrome and Firefox issue a warning if a site doesn’t use HTTPS secure connection for pages that has password fields.

Having an SSL certificate for your domain is an absolute must to make sure users do not see these warnings. Once you have the HTTPS configured, redirect HTTP site to HTTPS using .htaccess.

Add the following code to .htaccess file

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{SERVER_NAME}/$1 [R,L]

Once redirected, Configuring HTTPS for xenForo is simple and you can proxy the image URLs for image embed that aren’t on HTTPS that user may have embedded in post content.

Login to admin > Options > Messages and enable proxy images.

Note: If images are embedded in posts from your own domain, the redirect from HTTP to HTTPS will break the images because the proxy won’t work on the redirected images. So use post content replace plugin to change internal URLs from HTTP to HTTPS.

2. Use a CDN

You can move images, JavaScripts, CSS hosted on a CDN to allow user for parallel download of those resources as well as keep bandwidth and processing on your server low.

I am Amazon S3 with cloudfront for all my forums as it allows deliver of those static content (images, CSS and Javascripts) over an HTTPS.

3. Server Side Caching

XenForo works amazingly well with caching and you can see that in this thread here.

Set up APC and memcache on your server and then all you need is add few lines of settings code in your config.php file to get it up and running.

If you have server-side caching enabled, you can opt to minify CSS and serve templates through files.

Note: Server side caching may not be possible if you are on shared hosting.

4. Minify CSS / Templates as files

There are options to improve performance of xenForo forum at Admin > Options > Performance.

Minify CSS and serving templates from files instead of from database should definitely be considered.

You should enable minified CSS and public templates as file only if you have server side caching enabled.

If you don’t have server-side caching enabled, go for Enable Delayed Insert SQL Queries and Cache BB Code output.

5. jQuery CDN vs Locally Hosted

Use Google CDN to fetch jquery instead of hosting it on your own server or on your own CDN. It helps to be served as cached for a user and if not it will be downloaded parallelly for user giving faster user experience.

Options available at Admin > Options > Performance.

6. Defer JS

By default xenForo moved JavaScript’s to the bottom of the page just above the tag but if you are using any custom addon that puts JavaScript in the header, you can add Use DeferJS plugin to move it to the bottom of the page or manually edit templates to load scripts as late as possible for faster page rendering.

7. Fewer Add-Ons

Add-ons by newbies can be an issue in Xenforo. Everything in xenForo works on hooks that can be called multiple times but may not be needed to call so many times.

As an example, if an addon uses template hooks, a page can have multiple hooks executed and if the addon avoids an event hint, the hook function will be called multiple times unnecessarily.

Leaving the Event Hint blank is never recommended. Make sure each of the addons that you are using has event hint added in each hook/overload.

8. Leverage Browser Caching

As and when you can, cache the content in user browser because the next load for a user will be a lot faster.

Add the following code to the .htaccess file to enable browser caching for static content.

<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/gif A2592000
ExpiresByType image/jpeg A2592000
ExpiresByType image/jpg A2592000
ExpiresByType image/png A2592000
ExpiresByType image/x-icon A2592000
ExpiresByType text/css A86400
ExpiresByType text/javascript A86400
ExpiresByType application/x-shockwave-flash A2592000
<FilesMatch "\.(gif¦jpe?g¦png¦ico¦css¦js¦swf)$">
Header set Cache-Control "public"

9. Limit Spider Activity

You can limit spider activity on member pages or help pages to make sure your server doesn’t waste bandwidth to Google.

Note: Do this if you want the site members to name not to be used in Google to find your site or in short if you are using it as a social networking site.

Add the following lines to your robots.txt file

User-agent: *
Disallow: /members/*

10. Compress Output (GZIP)

Always compress the output to save extra bandwidth. Add the following code to .htaccess file.

<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE application/x-font
AddOutputFilterByType DEFLATE application/x-font-opentype
AddOutputFilterByType DEFLATE application/x-font-otf
AddOutputFilterByType DEFLATE application/x-font-truetype
AddOutputFilterByType DEFLATE application/x-font-ttf
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE font/opentype
AddOutputFilterByType DEFLATE font/otf
AddOutputFilterByType DEFLATE font/ttf
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE image/x-icon
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE text/plain

See also:

More …

If you still have issues you can hire me to get them implemented for you. 😀

Looking for your first paid client? I’ll show how

More in CMS
vBulletin 3.x and 4.x “Not Secure” In Google Chrome 56+ Fixed