optimize wordpress

Optimize WordPress Website without plugin is latest technology. This methods works with Lite-Speed web server only. If your hosting provider supports Lite-Speed web server, you don’t have to worry about your website optimization.

This tutorial is not generally for wordpress but this will works with any website runs on Lite-Speed web server.

You may use several plugins to boost-up your website, but using plugins will slow down your website. If you are a WordPress user, you must consider to use less plugins to your website. Plugins may resolve your problem without having technical knowledge but your website may suffer performance issues.

Check below how Lite-Speed boost-up your website compare to any types of server.

Optimize WordPress Website without plugin

The above chart shows how your website runs faster with Lite-Speed technology. You may get several plugins from WordPress to speed-up your website. Here is one of them:

Lite-Speed Cache WordPress Plugin will do the work very well. But if you edit your htaccess file and add some code into this, you don’t need any plugins for that. Check the below code and add it to your htacess file.

Code to Optimize WordPress Website Without Plugin

<IfModule mod_deflate.c>
 SetOutputFilter DEFLATE
 <IfModule mod_setenvif.c>
 # Netscape 4.x has some problems...
 BrowserMatch ^Mozilla/4 gzip-only-text/html

# Netscape 4.06-4.08 have some more problems
 BrowserMatch ^Mozilla/4\.0[678] no-gzip

# MSIE masquerades as Netscape, but it is fine
 # BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

# NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
 # the above regex won't work. You can use the following
 # workaround to get the desired effect:
 BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html

# Don't compress images
 SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary

<IfModule mod_headers.c>
 # Make sure proxies don't deliver the wrong content
 Header append Vary User-Agent env=!dont-vary

<IfModule Litespeed>
 RewriteEngine On
 RewriteRule .* - [E=noconntimeout:1]
 RewriteRule .* - [E=noabort:1]

 <IfModule mod_expires.c>
 ExpiresActive On
 ExpiresByType image/jpg "access 1 year"
 ExpiresByType image/jpeg "access 1 year"
 ExpiresByType image/gif "access 1 year"
 ExpiresByType image/png "access 1 year"
 ExpiresByType text/css "access 1 month"
 ExpiresByType text/html "access 1 month"
 ExpiresByType application/pdf "access 1 month"
 ExpiresByType text/x-javascript "access 1 month"
 ExpiresByType application/x-shockwave-flash "access 1 month”
 ExpiresByType image/x-icon "access 1 year"
 ExpiresDefault "access 1 month"

<ifModule mod_headers.c>
 Header set Connection keep-alive

# BEGIN Cache-Control Headers
 <ifModule mod_headers.c>
 <filesMatch "\.(ico|jpe?g|png|gif|swf)$">
 Header set Cache-Control "public"
 <filesMatch "\.(css)$">
 Header set Cache-Control "public"
 <filesMatch "\.(js)$">
 Header set Cache-Control "private"
 <filesMatch "\.(x?html?|php)$">
 Header set Cache-Control "private, must-revalidate"
 # END Cache-Control Headers

 <IfModule mod_headers.c>
 Header unset ETag

FileETag None
 # E TAG

# ------------------------------------------------------------------------------
 # | Compression |
 # ------------------------------------------------------------------------------

<IfModule mod_deflate.c>

# Force compression for mangled headers.
 # http://developer.yahoo.com/blogs/yd...
 <IfModule mod_setenvif.c>
 <IfModule mod_headers.c>
 SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
 RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding

# Compress all output labeled with one of the following MIME-types
 # (for Apache versions below 2.3.7, you don't need to enable `mod_filter`
 # and can remove the `<IfModule mod_filter.c>` and `</IfModule>` lines
 # as `AddOutputFilterByType` is still in the core directives).
 <IfModule mod_filter.c>
 AddOutputFilterByType DEFLATE application/atom+xml \
 application/javascript \
 application/json \
 application/rss+xml \
 application/vnd.ms-fontobject \
 application/x-font-ttf \
 application/x-web-app-manifest+json \
 application/xhtml+xml \
 application/xml \
 font/opentype \
 image/svg+xml \
 image/x-icon \
 text/css \
 text/html \
 text/plain \
 text/x-component \


If you have multiple websites in your cpanel, you don’t have to add this code to all your website folder. Just create a .htaccess file into your home directory and add this code. This will optimize your all websites.

Leave a Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.