0

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

aneuryzm
  • 1,714
  • 5
  • 26
  • 41

1 Answers1

0

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.

runlevelsix
  • 2,619
  • 22
  • 20
  • ok I see, so is correct ? Or I actually don't need the * in the end ? I've actually tried both but it doesn't work. I'm missing something.. I've .htaccess file in the website directory and mod_rewrite is on – aneuryzm Nov 02 '10 at 22:28
  • You have `RewriteEngine On`? Crank up the `RewriteLogLevel` to 3 to see what is happening. – Mark Wagner Nov 02 '10 at 23:19
  • If you want the `` directive to match a regular expression, per http://httpd.apache.org/docs/2.0/mod/core.html#directory, you need to use the ~ before the regex so that Apache knows how to interpret the directive (such as ``. But by default, "Directives enclosed in a section apply to the named filesystem directory and all subdirectories of that directory", so you should not need a regex to apply to all subdirectories of /var/www (http://httpd.apache.org/docs/2.0/sections.html#file-and-web). – runlevelsix Nov 03 '10 at 13:36