Page is a not externally linkable
jdMorgan - 2:38 pm on Jul 13, 2010 (gmt 0)
You can speed this up a bit:
RewriteEngine On
RewriteBase /
#
RewriteCond %{QUERY_STRING} ^cat=1(&.+)?$
RewriteRule ^index\.php$ http://domain.com/category/some_category/? [L,R=301]
#
# BEGIN tweaked WordPress
#
RewriteCond $1 !(^index\.php|\.(gif|jpe?g|png|ico|css|js))$
RewriteCond %{QUERY_STRING} !^([^&]*&)*cat=24(&.+)?$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ /index.php [L]
#
# END WordPress
I'm not sure what that "!cat=24" exclusion is for. If it applies only to index.php requests, then that RewriteCond should not be needed, since the index.php URL-path is already excluded by the first RewriteCond.
If it is needed, then the more-specific pattern shown prevents matches on "scat=24" and/or "cat=241".
Excluding requests for the most-frequently-requested objects NOT generated by WP prevents the unnecessary and wasteful RewriteCond calls to the OS to check for "file or directory exists" on these requests. You may actually see a noticeable speed-up of your site by avoiding these checks when not needed.
The bottom line on -d, -f, and the other "exists-checks" is that they should always be done last whenever possible and should only be done when absolutely necessary. The same is true for reverse-DNS lookups using "RewriteCond ${REMOTE_HOST}" which is also very-slow and resource-intensive function.
The <IfModule> container is only needed if you want this code to fail silently on servers where mod_rewrite is not available. Otherwise, it's a waste of time and CPU...
Jim