How to Tweak .htaccess to Improve WordPress Speed & Security ?

Tweak .htaccess to Optimize WordPress Speed & Security

wordpress speed and securityThis is how I have optimized my .htaccess for to Improve WordPress Speed and Security

Lets start with the CODE in the .htaccess file, yours will always be in the root folder of your WordPress installation.

When you FTP in to your hosting account, look for public_html or home.
If you see the .htaccess right click edit.
If you don’t see it, use cPanel File Manger and select show Hidden Files (dotfiles).

Click here, if you want to do it for WordPress 3.6

Edit .htaccess File for Speed Optimization

1) Line 1 to 68 is all thx to 5G BLACKLIST/FIREWALL by Jeff Starr
2) Line 70 to 74 is all Server Security Tweaks thx to Josiah Cole
3) Line 78 to 83 These are only there for testing by me, Mark de Scande.  PS These settings below can be used  in your php.ini

#php_value max_execution_time 800 # I Use 140 
#php_value max_input_time 800 # I Use 150
#php_value memory_limit 512M # I Use 96M
#php_value upload_max_filesize 30M # I Use 16M
#php_value post_max_size 30M # I Use 16M

How do I add a custom php.ini file to my host ?

Option 1: .htaccess – Just add the details to it and test your site if your site don’t load, then remove the details.

Option 2: Use Note Pad ++ Make a new file add the content’s Ie php_value max_execution_time 800 etc
Then save it is php.ini.  Now upload the file to the /root of your WordPress installation ,the same place were you had the .htaccess file.
Now pull up your site, if it loads your good to go, if not delete the file.

Option 3: Ask your host or get a better host Like my buddy AECNU, were BlogLines.co.za is proudly hosted from.

4) Line 85 to 86 Speed Tips: Turn Off ETags Credit to Charles Torvalds

5) Line 88 to 102 Now here you would first have to have a look at your php settings on your site. Make a file and call it happy.php then add the contents of How To Get PHP Settings.

6) Line 104 to 134 That’s all to do with images and helps a lot with your GT Metrix score

7) Line 139 to 153 That’s all to do with Security go Test your site at  Sucuri Security — Protect Your Interwebs! I love these guys.

8) Line 155 to 158 don’t Just copy and paste. You have to make your own it is easy. I will show you how.

  1. ErrorDocument 404 /404.shtml
  2. ErrorDocument 403 /403.shtml
  3. ErrorDocument 500 /500.shtml

Log in to cPanel, go to the bottom of the page look for Error pages, now go and edit the pages you need.

9) Line 160 To 182 That is for WordPress MU

Speed Tests to Check Site Speed Improvements

Now After Tweaking .htaccess

GT Metrix.com

GTmetrix test after tweaking .htaccess
Page load time: 2.35s
Total page size: 618KB
Total number of requests: 85

WebPageTest.org

WebPagetest Test after configuring .htaccess for optimizing speed
Start Load 0.413s
Full Load 6.415s
Yes They are all green

Pingdom.com

Pingdom Tools Test after site optimization
Load time 1.96s
Requests 89
Perf. Grade 80/100

The good news is, when it comes to tweaking…My site, BlogLines.co.za rocks.

My Great Success comes from:
Just by tweaking one file ….Having A Great hosting provider…  And Having Great plugins

You can Hire me through UpWork to Tweak your WordPress 3.5 Site.

WordPress 3.5 Speed and Security – Post Made Pretty by Charissa de Scande (Lotter) 

Would you like to book me for optimizing your site : Please book me through UpWork

Author 


WordPress Site Speed Expert, Speeding up WordPress sites across the Globe

I am the fuel behind the high speed of innumerable fast running wordpress websites hosted either on a cheap server or a dedicated server.
Today, Speed is a matter of great concern, and I don’t only optimize but re-energize. I am also a lifetime WPMU Dev member.


One of the largest free blogging websites BlogLines in South Africa is my baby. I not only conceived the idea of free blogging in South Africa, but also implemented it with an objective of adding a new dimension to the world of free blogging. Blogging helps us in enhancing the quality of our social life by transforming the ways in which we share our ideas and opinions with each other. South Africa blogging environment has never been so easy and user-friendly as it is today.

I have practised and learned all the technical aspects related to WordPress. In the past couple of years, I have developed a wide range of websites using WordPress, WordPress MU and now using the latest WordPress MultiSite.

I am the WordPress Speed Energizer Wiz, and I am always hunting around to find slow running websites. I know, these websites need me in order to live a long and healthy life.
Only the wordpress sites powered with speed, capable of running at full throttle are going to survive in this tough and competitive world of Internet.


Need my help but can not afford my hourly rate buy me coffee and i will do a full report on your website.

    Follow Me:
  • facebook
  • flickr
  • googleplus
  • linkedin
  • pinterest
  • twitter
  • youtube
  1. Mark De Scande BlogLines
    Mark De Scande BlogLines01-02-2013

    Wow I love it when i give out my advice and thoughts on how i did stuff.

  2. Mark De Scande BlogLines
    Mark De Scande BlogLines01-03-2013

    If you have problems with Menu Items not working Dump Line 4 – 20

  3. bloglines
    bloglines01-03-2013

    Nice Post by me Mark

  4. Mark de Scande
    Mark de Scande01-12-2013

    Super Post :)

  5. Charissa De Scande Lotter
    Charissa De Scande Lotter01-12-2013

    My First Comment on BlogLines.co.za Super cool site well done @mark de scande

  6. Charissa De Scande Lotter
    Charissa De Scande Lotter01-12-2013

    Post some comments

  7. Russell Jamieson (@russelljamieson)
    Russell Jamieson (@russelljamieson)01-14-2013

    Hi Mark,

    (Russell from AuthorSure here)

    Nice post. WordPress security and performance is something I have been looking at myself in the last few days. I can improve my own settings by adding the User Agent blocks from your .htaccess file. Thanks.

    You might like to check out http://www.wpwhoosh.com – this does the performance and security tuning of the .htaccess file very similar to what you have recommended. First it creates the add-on domain and the WordPress database with strong security, it then installs and configures WordPress, your choice of theme, and a dozen really useful plugins for SEO as well as security and performance. Then it tunes up the htaccess, robots and XML sitemap files. The initial site also comes with a standard pages such as Privacy Statement, Terms and Conditions and a Contact Form, and a footer with copyright and trademarks that adds to the credibility of your site with both humans and search engines.

    And all this is whooshed into existence with a click of a button and it is done and dusted in 60 seconds. WP Whoosh is a great time saver that gives you a reliable and secure starting point for a new site – then all you need to do is add your our content.

    If, at Bloglines, you are creating lots of sites for clients on separate platforms (non WordPress MU) then it could improve your productivity and hence profitability significantly. Check it out.

  8. Mark de Scande (@bloglinessa)
    Mark de Scande (@bloglinessa)01-14-2013

    Super Cool System http://www.wpwhoosh.com love it IT wont work on the BlogLines.co.za system as it hosts about 100K in Blogs but i will be looking at it for my customers :)

    Thank you for dropping by Ps To all my friends go have a look at Russell site http://www.authorsure.com/ it is super cool :)

  9. Home Business Tax Coach
    Home Business Tax Coach02-04-2013

    Let say guys that Mark truly is awesome in tweaking your wordpress. You will not be disappointed at all. :)

  10. Mark de Scande
    Mark de Scande02-04-2013

    @Home Business Tax Coach Love the new site http://www.homebusinesstaxcoach.com/ love it well done

  11. Mark de Scande
    Mark de Scande03-16-2013

    Love the new comment system :)

  12. Miles Harrop
    Miles Harrop03-19-2013

    Well done @bloglines:disqus nice read

Leave a Reply