Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Installing & running WordPress (http://forum.bytesforall.com/forumdisplay.php?f=6)
-   -   [SOLVED] Modifying htaccess to speed things up (http://forum.bytesforall.com/showthread.php?t=6208)

Shepherd Jim Mar 8, 2010 03:01 PM

[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!

juggledad Mar 9, 2010 05:43 AM

Well I decided to try this. I added the footer query code and ran under FireFox with firebug and refreshed the page a number of times and got some numbers, then changed the htaccess and did it again.
I may have shaved off a couple tenth's of a second, but couldn't really tell.

If you have a site that is extremely active and every millisecond counts, then I'd say put this in, if not what's a millisecond when displaying a page.

Shepherd Jim Mar 9, 2010 07:11 AM

Hey J'Dad: Thanks! I may try this on my test site which has really slow page load times. I've sort of decided that I need to build a fire under GoDaddy's butt, but the problem still might be the way I have things set and adjusting the .htaccess might help.

So! ...in the meantime, what about the apparent duplication of the lines:


<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

in my .htaccess? Does having those lines run twice make any sense? ...maybe this is the root of my slow page loads?


juggledad Mar 9, 2010 07:25 AM

I'd remove the duplicates

Shepherd Jim Mar 9, 2010 12:34 PM

..in for a penny ...

I took a deep breath and deleted the first set of lines of code -- Nos. 1 - 7.

Everything seems fine -- no difference in load times.

All times are GMT -6. The time now is 12:59 PM.

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