FW: [wp-hackers] Putting mod_rewrite rules in httpd.conf

Brian Layman Brian at TheCodeCave.com
Fri Sep 1 21:09:32 GMT 2006


Hmm, let's try this again. It's been an hour-and-a-half, and the first copy
of this message hasn't yet posted.  That's never happened before.
Hopefully, this isn't going to be a re-post...

[...]

>>>somewhat related, is whether it would be possible to make WP  honor 
>>>rules in httpd.conf versus using .htaccess files?

Actually, as I understand it, WP will 'honor' everything you put in either
file (when they are active).  It has no choice.  WP has no idea anything is
happening until after the rewrite engine, wherever it is configured,
releases the formatted request.

So, in short, you can put the stuff anywhere you want it to be.  One thing
though... In the newer versions of WP, all the rewrite rules say to do is
"If this doesn't point at a file, send it to WP.".  If your file has more
than those 9 or so lines total, then either it contains your own
customizations or it is all legacy WP stuff.  The legacy WP stuff is
redundant to what is now included in the WordPress PHP code.  For the
current version of WP, you just need: # BEGIN WordPress <IfModule
mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond
%{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule .
/index.php [L] </IfModule> # END WordPress

And all should work fine.

>Anyone actually do this, or does everyone stick with .htaccess?
It is an optimization to stick the rules in the conf file and set
"AllowOverride None".  With "AllowOverride All" every request to the server
results in it repeatedly searching up the directory tree for .htaccess
files.  Any optimization that avoids disk access (even if it is cached) is
to be desired.  I would suspect many people put their stuff in the .conf
file and set it "AllowOverride None" making the server ignore any and all
.htaccess files.

_______________________________________________
Brian Layman
www.TheCodeCave.com
 



More information about the wp-hackers mailing list