Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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>
share|improve this question

1 Answer 1

up vote 3 down vote accepted
+50

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.

share|improve this answer
    
In that case, would it be possible for you to tell me what's wrong with this? 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 8: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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.