Wordpress Themes - WP Forum at BFA
There will be no more development for Atahualpa (or any other theme), and no support. Also no new registrations. I turned off the donation system. I may turn the forum to read only if it gets abused for spam. Unfortunately I have no time for the forum or the themes. Thanks a lot to the people who helped in all these years, especially Larry and of course: Paul. Take care and stay healthy -- Flynn, Atahualpa developer, Sep 2021

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

[SOLVED] Modifying htaccess to speed things up


  #1  
Old Mar 8, 2010, 04:01 PM
Shepherd Jim's Avatar
Shepherd Jim
 
301 posts · Feb 2009
Bristol, midcoast Maine USA
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:
Code:
# 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:
Code:
 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?

Jim
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.
  #2  
Old Mar 9, 2010, 06:43 AM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
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.
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #3  
Old Mar 9, 2010, 08:11 AM
Shepherd Jim's Avatar
Shepherd Jim
 
301 posts · Feb 2009
Bristol, midcoast Maine USA
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:

Code:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
in my .htaccess? Does having those lines run twice make any sense? ...maybe this is the root of my slow page loads?

Jim
  #4  
Old Mar 9, 2010, 08:25 AM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
I'd remove the duplicates
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #5  
Old Mar 9, 2010, 01:34 PM
Shepherd Jim's Avatar
Shepherd Jim
 
301 posts · Feb 2009
Bristol, midcoast Maine USA
..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.

Bookmarks

Tags
htaccess



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 02:29 PM.


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