0
votes

I have the following in a .htaccess file as a test:

RewriteEngine on
RewriteRule ^(.*)$ /backend/$1

This works as expected. I was able to get rewrite logging working with the following in apache2.conf:

<IfModule mod_proxy.c>
    RewriteLog "/tmp/REWRITE.log"
    RewriteLogLevel 9
</IfModule>

The log file is created and logs debug info as expected. However, when I delete the .htaccess file, change the apache2.conf directive as follows, and restart apache to do the equivalent globally, it doesn't work.

<IfModule mod_proxy.c>
    RewriteLog "/tmp/REWRITE.log"
    RewriteLogLevel 9
    RewriteEngine on
    RewriteRule ^(.*)$ /backend/$1
</IfModule>

I'm using Apache/2.0.55 on Ubuntu.

Help!

3
Any further diagnosis other than it doesn’t work?Gumbo

3 Answers

0
votes

Have you tried this ?

    RewriteEngine on
    RewriteRule ^(.*)$ /backend/$1

<IfModule mod_proxy.c>
    RewriteLog "/tmp/REWRITE.log"
    RewriteLogLevel 9

</IfModule>

Because this way I was able to do rewriting, but log didnt worked hence a issue in mod_proxy.c

0
votes

Have you considered turning RewriteEngine on before any other rewrite directives?

0
votes

Are your RewriteRule directives contained within a particular server definition? Do you have virtual servers at work?

The reason I ask this is that you say this works in an .htaccess file which is directory specific; although officially the documentation says that RewriteRule can apply to server config, virtual host, directory, .htaccess.