How to debug Apache mod_rewrite

后端 未结 5 1305
不思量自难忘°
不思量自难忘° 2020-11-22 04:56

I have two main problems with mod_rewrite:

1) There is no meaningful error reported when I have an invalid rule

5条回答
  •  遇见更好的自我
    2020-11-22 05:23

    Based on Ben's answer you you could do the following when running apache on Linux (Debian in my case).

    First create the file rewrite-log.load

    /etc/apache2/mods-availabe/rewrite-log.load

    RewriteLog "/var/log/apache2/rewrite.log"
    RewriteLogLevel 3
    

    Then enter

    $ a2enmod rewrite-log

    followed by

    $ service apache2 restart

    And when you finished with debuging your rewrite rules

    $ a2dismod rewrite-log && service apache2 restart

提交回复
热议问题