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

Alan J Castonguay alan at verselogic.net
Mon Sep 4 21:01:09 GMT 2006

Paul Menard wrote:
> I've tried and and it works. For the sake of example here is my actual 
> Virtual Host entry. This is a local copy of WordPress pulled from 
> Subversion this weekend. Fresh install.
> During the setup I went through my normal configuration via Options -> 
> Permalinks. Once I have generated the .htaccess file I copied the 
> contented into my httpd.conf and then removed the .htaccess file.
> I'm not sure what happend to the Options -> Permalinks coding if you 
> later attempt to update the .htaccess file.
> <VirtualHost>
>     ServerName dev.wpsvn.com
>     ServerAdmin webmaster
>     DocumentRoot     /usr/local/htdocs/dev/dev.wpsvn.com
>     ErrorLog         /private/var/log/httpd/dev/dev.wpsvn.com/error_log
>     CustomLog         
> /private/var/log/httpd/dev/dev.wpsvn.com/access_log common
>     <Directory         /usr/local/htdocs/dev/dev.wpsvn.com>
>         AllowOverride All
>         # BEGIN WordPress
>         <IfModule mod_rewrite.c>
>             RewriteEngine On
>             RewriteBase /wordpress/
>             RewriteCond %{REQUEST_FILENAME} !-f
>             RewriteCond %{REQUEST_FILENAME} !-d
>             RewriteRule . /wordpress/index.php [L]
>         </IfModule>
>         # END WordPress
>     </Directory>
> </VirtualHost>

I take it you've moved .htaccess out of the way? If so, the above should 
work fine. However, you're not going to get any performance improvement 
unless you also set "AllowOverride None", like Brian said. The whole 
point of moving the rewrite rules into your httpd.conf is to /not/ go 
checking the drive for .htaccess files.

The .htaccess file doesn't need to be updated when permalinks change. 
(It used to in a former version of wordpress, which resulted in huge 
lists of rules.)

Alan J Castonguay

More information about the wp-hackers mailing list