0

Say my Apache configuration file '/etc/apache2/httpd.conf' looks like this (I don't use .htaccess):

<Directory /var/www/whatthenerd.com/public>
    AllowOverride None

    <IfModule mod_rewrite.c>
        Options +FollowSymlinks
        RewriteEngine On
        RewriteBase /

        [...]
    </IfModule>

    [...]
</Directory>

<Directory /var/www/whatthenerd.com/public/uploads/css>
    <IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteBase /uploads/css/

        [...]
    </IfModule>
</Directory>

Considering that /var/www/whatthenerd.com/public/uploads/css is a sub-directory of /var/www/whatthenerd.com/public, I believe I can merge the rules. But somehow, I am unable to get it to work.

I am not sure what's wrong with this, and why it isn't working...

<Directory /var/www/whatthenerd.com/public>
    AllowOverride None

    <IfModule mod_rewrite.c>
        Options +FollowSymlinks
        RewriteEngine On
        RewriteBase /

        [...]
    </IfModule>

    [...]

    <IfModule mod_rewrite.c>
        RewriteBase /uploads/css/

        [...]
    </IfModule>
</Directory>
its_me
  • 225
  • 1
  • 7
  • 23

1 Answers1

3

The answer is "no, you can't, because it doesn't work that way". You can't have two RewriteBase within the same Directory context.

Jenny D
  • 27,780
  • 21
  • 75
  • 114
  • In that case, would it be possible for you to tell me what's wrong with this? http://serverfault.com/a/540990/102450 The answer used to work, but now, it doesn't, and I can't figure out why. – its_me Oct 21 '13 at 08:29
  • "doesn't work" is insufficient data to give any useful answer. Start by turning on logging and reading the rewrite logs. – Jenny D Oct 21 '13 at 10:00
  • **Note to self:** Nevermind, they weren't working because the `Include httpd.conf` directive was missing in apache's main configuration file, i.e. /etc/apache2/apache2.conf. – its_me Oct 21 '13 at 16:48