How to enable rewrite module for all subfolders

mod-rewrite

I want to enable rewriting for all websites on my server.

Instead of having to add for each website

<Directory /var/www/mywebsite1>
    AllowOverride All
</Directory>

<Directory /var/www/mywebsite2>
    AllowOverride All
</Directory>

...

Can I just write something like

<Directory /var/www/*>
    AllowOverride All
</Directory>

to specify I want rewrite enable on all subfolders ?

thanks

Best Answer

I believe that the following question answered here on ServerFault will answer your question:

Apache: Using same Directory directive for multiple virtual hosts

Short version is, yes, you can generally place a Directory directive outside of your VirtualHosts containers so that it will be applicable to all VirtualHosts.

Related Topic