[wp-hackers] #2740: Include .htaccess in distribution

Kimmo Suominen kimmo+key+wordpress.c4f53f at suominen.com
Wed May 24 05:56:06 GMT 2006

On Tue, May 23, 2006 at 07:25:09AM -0400, Owen Winkler wrote:
> Kimmo Suominen wrote:
> >I like the idea that .htaccess is not touched once a site is up and
> >running.

Just to make it clear, my main point was that I think including
.htaccess in the distribution is a dangerous idea, as it can easily
lead to users unintentionally overwriting their .htaccess files.

When WP modifies .htaccess it is careful about keeping old rules (or
at least it used to be).

> Plugins require access to .htaccss that is currently provided via hook. 
>  If you install .htaccess at the onset and disallow WordPress from 
> altering it, all of those plugins become broken.

I'm curious what these plugins do that WP's rewrite processing cannot
do for them.

> I'm curious why disabling write access to .htaccess after its initial 
> setting by WP is not enough for folks who need that level of control.

I can't answer that one, as that's asking about something I didn't

But I still like the idea of .htaccess not being modified.  I think
it would be better if WP's own rewrite processing could work for all

Personally I'd even be happy to just add the few simple rules needed
by WP into .htaccess myself, but I think it is nice that WP does it
for me.

However, the rules can get hairy when more than one package is using
virtual URL's (i.e. ones that don't map directly to files).  I only
have one such package installed currently, but it took me a while to
figure out how to make it run nicely in a subdirectory with WP in
the top level directory:

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !^/(photos)/
    RewriteRule ^(.+)$ /index.php/$1 [L,QSA]

I wouldn't expect WP to be able to preserve the extra rule in there.
Nothing is impossible but I think it would be a slippery road to try
and catch all the variations people might use.

An "obvious" solution would be to run WP in a subdirectory as well,
and I'll probably migrate to that at some point.

Best regards,
+ Kimmo
<A HREF="http://kimmo.suominen.com/">Kimmo Suominen</A>

More information about the wp-hackers mailing list