Debugging mod_rewrite

I play with the mod_rewrite Apache module and want to know if there is a decent way to output some debugging information? For example, the documentation contains a list of available variables:

%{HTTP_USER_AGENT}, %{HTTP_REFERER}, %{HTTP_COOKIE} ... etc

Is there a way so that I can output them just to see what I'm working with? I installed RewriteLog (level 2) and looked at it, but it would be nice to see the value of the variables.

+3
source share
1 answer

HTTP_ variables come from HTTP headers, so you can print them using server-side scripts, like most other variables. For special variables, you can write their values ​​to RewriteCond and add them to the query string.

RewriteCond RF=%{REQUEST_FILENAME}&API=%{API_VERSION} (.*)
RewriteRule ... ...?%1 [QSA]

, .

+1

Source: https://habr.com/ru/post/1738913/


All Articles