Permalinks are one essential part of any WordPress installation to have a example.com/nice-url/ instead of example.com/?p=378.The translation of the ugly looking URL into the cute URL is performed by the Apache server instructed by the rewrite rules in the .htaccess file. Even though WordPress can write the proper rules, there are some rules that are said to optimize the redirection and thus the page loading time.
Having found these rewrite rules for the WordPress .htaccess in a local installation, I remembered that while researching some ways to optimize WordPress speed and load up times, I found these rules in a forum.
# 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¦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
Unfortunately, I can’t seem to locate the forum again (so if you know the user who wrote them let me know so I can quote him). These rules are said to speed up page loading times and you can see from the code that they are much more strict than those created by WP itself making explicit redirection rules for certain file types. From what I’ve tested them, they work pretty much in the same way than usual rules. So it’s your turn, what kind of rewrite rules do you use? How do WP standard rules perform compared to your own?
ill give a try ASAP! thx 4 the tip!
Here is the profile of the author I believe, http://www.webmasterworld.com/profilev4.cgi?action=view&member=jdMorgan
and here is the forum post:
http://www.webmasterworld.com/apache/4053973.htm
Wow this is an amazing piece of code. Thank you for the share, I noticed a large improvement with load time on client sites.