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

Scott Plumlee wp-hackers at plumlee.org
Mon Sep 4 15:46:39 GMT 2006


Computer Guru wrote:
> On 9/1/06, Brian Layman <Brian at thecodecave.com> wrote:
>> >>>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.

That's exactly what I was wondering about.  I'm going to try this out 
and see.



More information about the wp-hackers mailing list