views:

501

answers:

1

Concerning the .htaccess documenation, putting a .htaccess file in a directory should affect this directory and all subdirectories. But I have problems getting this to work:

I have to files, alice.html and bob.html (just printing "Alice" and "Bob"), and this .htaccess in the same directory (/tmp/rewrite):

RewriteEngine on
RewriteBase /tmp/rewrite
RewriteRule ^alice.html$ bob.html

When I try to access /tmp/rewrite/alice.html I get "Bob" - fine.

But when I put the same html file in a subdirectory /tmp/rewrite/sub and try to access /tmp/rewrite/sub/alice.html I get "Alice".

What am I missing?

A: 

Hi,

The behaviour is just normal .. You told apache to mod_rewrite alice.html into bob.html in case it's present on the defined "root" for those rules. If you want to apply rules to other folders, you'd have to apply several more rules, like so :

RewriteRule ^/sub/alice.html$ /sub/bob.html
yoda