Wordpress Themes - WP Forum at BFA
Click here to register or to donate.
Auto self-registration is not available here - far too many spammers. This forum has many, many backlinks and because of that there is an intense desire among spammers to drop their links here.

Wordpress Themes - WP Forum at BFA » Running WordPress » Installing & running WordPress »

[SOLVED] Modifying htaccess to speed things up

Prev Previous Post   Next Post Next
Old Mar 8, 2010, 04:01 PM
Shepherd Jim's Avatar
Shepherd Jim
301 posts · Feb 2009
Bristol, midcoast Maine USA
[SOLVED] Modifying htaccess to speed things up

I was listening to a WP podcast today and they mentioned a copy and paste modification you can make to your .htaccess file that will speed up your WordPress site loads.

This suggestion is put forward by ghacks.net -- Speed Up Wordpress With Better Permalink Rewrite Code As I understand it, the way ghacks has organized the code reduces unnecessary "calls" and "checks"

Simply, you paste the following into your.htaccess file replacing what's already there between "# BEGIN WordPress" and "# END WordPress".

Code to be pasted:
# BEGIN WordPress
RewriteEngine on
# Unless you have set a different RewriteBase preceding this point,
# you may delete or comment-out the following RewriteBase directive
# RewriteBase /
# if this request is for "/" or has already been rewritten to WP
RewriteCond $1 ^(index\.php)?$ [OR]
# or if request is for image, css, or js file

RewriteCond $1 \.(gif|jpg|php|ico|css|js)$ [NC,OR]
# or if URL resolves to existing file
RewriteCond %{REQUEST_FILENAME} -f [OR]
# or if URL resolves to existing directory
RewriteCond %{REQUEST_FILENAME} -d
# then skip the rewrite to WP
RewriteRule ^(.*)$ - [S=1]
# else rewrite the request to WP
RewriteRule . /index.php [L]
# END wordpress
I was wondering if Flynn, J'Dad or anyone else here who understands the .htaccess better than me has any thoughts about this.

AND, while I'm at it -- in looking at one of my .htaccess files I find what looks like a duplication:
 1. <IfModule mod_rewrite.c>
 2. RewriteEngine On
 3. RewriteBase /
 4. RewriteCond %{REQUEST_FILENAME} !-f
 5. RewriteCond %{REQUEST_FILENAME} !-d
 6. RewriteRule . /index.php [L]
 7. </IfModule>

 8. # BEGIN WordPress
 9. <IfModule mod_rewrite.c>
10. RewriteEngine On
11. RewriteBase /
12. RewriteCond %{REQUEST_FILENAME} !-f
13. RewriteCond %{REQUEST_FILENAME} !-d
14. RewriteRule . /index.php [L]
15. </IfModule>

16. # END WordPress

17. redirect 301 /nostdir.html http://www.hatchtown.com/tools/misc-tools/nosting

18. redirect 301 /strait.html http://www.hatchtown.com/tools/spindles/spindle-hook-tuning
note: I've added the line numbers to simplify this discussion.

Question: Is the code in lines 1. - 7. accomplishing anything that won't be done by 8. - 16.? Can I just delete those lines?

PS _ I was going to ask WHICH .htaccess file in my site's directories was the "active" one, but I found where Paulae asked that LAST month and J'Dad already answered -- the system does work!

Last edited by Shepherd Jim; Mar 8, 2010 at 04:17 PM.



Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help me to speed up my site, please. johnd28 Atahualpa 3 Wordpress theme 3 Jan 31, 2010 12:52 PM
Can anyone recommend a method to insert a table so I can list things for sale? cdgeorge Plugins & Atahualpa 8 Oct 26, 2009 05:23 AM
Formatting the WordPress text widget to keep things consistent looking with theme cdgeorge Sidebars & Widgets 1 Oct 22, 2009 06:28 AM
Speed paulharrisjr Atahualpa 3 Wordpress theme 4 Aug 4, 2009 10:03 PM
Section for All things Google ldsmedia Atahualpa 3 Wordpress theme 0 Jun 4, 2009 03:02 PM

All times are GMT -6. The time now is 07:03 PM.

Powered by vBulletin® Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.