Tutorials
Speed up Your website easily using Apache Htaccess

There are codes which You should copy and paste to .htaccess in root folder (Where index.php is located).


This compressing will work only if You using apache server.

Compressing by using this script will speed up your site 30-40%. Second this is that it will save Your bandwidth up to 50%.

Test Your site speed here:
Google Insights
Pingdom

Apache .htaccess GZIP Compression:

# Enable GZIP
<ifmodule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
</ifmodule>

# Expires Headers - 2678400s = 31 days
<ifmodule mod_expires.c>
  ExpiresActive On
  ExpiresDefault "access plus 1 seconds"
  ExpiresByType text/html "access plus 7200 seconds"
  ExpiresByType image/gif "access plus 2678400 seconds"
  ExpiresByType image/jpeg "access plus 2678400 seconds"
  ExpiresByType image/png "access plus 2678400 seconds"
  ExpiresByType text/css "access plus 518400 seconds"
  ExpiresByType text/javascript "access plus 2678400 seconds"
  ExpiresByType application/x-javascript "access plus 2678400 seconds"
</ifmodule>

# Cache Headers
<ifmodule mod_headers.c>
  # Cache specified files for 31 days
  <filesmatch "\.(ico|flv|jpg|jpeg|png|gif|css|swf)$">
  Header set Cache-Control "max-age=2678400, public"
  </filesmatch>
  # Cache HTML files for a couple hours
  <filesmatch "\.(html|htm)$">
  Header set Cache-Control "max-age=7200, private, must-revalidate"
  </filesmatch>
  # Cache PDFs for a day
  <filesmatch "\.(pdf)$">
  Header set Cache-Control "max-age=86400, public"
  </filesmatch>
  # Cache Javascripts for 31 days
  <filesmatch "\.(js)$">
  Header set Cache-Control "max-age=2678400, private"
  </filesmatch>
</ifmodule>

Apache deflate-compression:

/etc/apache2/mods-enabled/deflate.conf

<IfModule mod_deflate.c>
        <IfModule mod_filter.c>
                # these are known to be safe with MSIE 6
                AddOutputFilterByType DEFLATE text/html text/plain text/xml

                # everything else may cause problems with MSIE 6
                AddOutputFilterByType DEFLATE text/css
                AddOutputFilterByType DEFLATE application/x-javascript application/javascript application/ecmascript
                AddOutputFilterByType DEFLATE application/rss+xml
                AddOutputFilterByType DEFLATE application/xml
        </IfModule>
</IfModule>
There are codes which You should copy and paste to .htaccess in root folder (Where index.php is located). ========================================================================================================= --------------------------------------------------------------------------------------------------------- #### This compressing will work only if You using apache server. #### Compressing by using this script will speed up your site 30-40%. Second this is that it will save Your bandwidth up to 50%. **Test Your site speed here:** [Google Insights](http://developers.google.com/speed/pagespeed/insights/) [Pingdom](http://tools.pingdom.com/) Apache .htaccess GZIP Compression: ---------------------------------- ```` # Enable GZIP &lt;ifmodule mod_deflate.c&gt; AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript BrowserMatch ^Mozilla/4 gzip-only-text/html BrowserMatch ^Mozilla/4\.0[678] no-gzip BrowserMatch \bMSIE !no-gzip !gzip-only-text/html &lt;/ifmodule&gt; # Expires Headers - 2678400s = 31 days &lt;ifmodule mod_expires.c&gt; ExpiresActive On ExpiresDefault &quot;access plus 1 seconds&quot; ExpiresByType text/html &quot;access plus 7200 seconds&quot; ExpiresByType image/gif &quot;access plus 2678400 seconds&quot; ExpiresByType image/jpeg &quot;access plus 2678400 seconds&quot; ExpiresByType image/png &quot;access plus 2678400 seconds&quot; ExpiresByType text/css &quot;access plus 518400 seconds&quot; ExpiresByType text/javascript &quot;access plus 2678400 seconds&quot; ExpiresByType application/x-javascript &quot;access plus 2678400 seconds&quot; &lt;/ifmodule&gt; # Cache Headers &lt;ifmodule mod_headers.c&gt; # Cache specified files for 31 days &lt;filesmatch &quot;\.(ico|flv|jpg|jpeg|png|gif|css|swf)$&quot;&gt; Header set Cache-Control &quot;max-age=2678400, public&quot; &lt;/filesmatch&gt; # Cache HTML files for a couple hours &lt;filesmatch &quot;\.(html|htm)$&quot;&gt; Header set Cache-Control &quot;max-age=7200, private, must-revalidate&quot; &lt;/filesmatch&gt; # Cache PDFs for a day &lt;filesmatch &quot;\.(pdf)$&quot;&gt; Header set Cache-Control &quot;max-age=86400, public&quot; &lt;/filesmatch&gt; # Cache Javascripts for 31 days &lt;filesmatch &quot;\.(js)$&quot;&gt; Header set Cache-Control &quot;max-age=2678400, private&quot; &lt;/filesmatch&gt; &lt;/ifmodule&gt; ```` Apache deflate-compression: --------------------------- /etc/apache2/mods-enabled/deflate.conf ```` &lt;IfModule mod_deflate.c&gt; &lt;IfModule mod_filter.c&gt; # these are known to be safe with MSIE 6 AddOutputFilterByType DEFLATE text/html text/plain text/xml # everything else may cause problems with MSIE 6 AddOutputFilterByType DEFLATE text/css AddOutputFilterByType DEFLATE application/x-javascript application/javascript application/ecmascript AddOutputFilterByType DEFLATE application/rss+xml AddOutputFilterByType DEFLATE application/xml &lt;/IfModule&gt; &lt;/IfModule&gt; ````
91
0
1
live preview
enter atleast 20 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft