Apache tips

configuration

set environment variables for PHP in apache config:

<VirtualHost *:80>
    ...

    SetEnv MY_NAME lee

set php ini values in apache config

<VirtualHost *:80>
    ...

    # !! CAT NOT USE PHP CONSTANTS, USE INT VALUES INSTEAD !!
    # 22519 means: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
    php_admin_value error_reporting 22519

redirection

rewrite log

rewrite loggin

in Apache 2.4+, RewriteLog and RewriteLogLevel directives have been replaced, use the LogLevel directive

LogLevel alert rewrite:trace3

check rewrite logs:

tail -f error_log|fgrep '[rewrite:'

rewrite example, rewrite query strings as path

# redirect testing: add query string to path
RewriteCond %{QUERY_STRING} ^(.+)$
RewriteRule ^redirecttest.html$ redirecttest@%1.html [L]

makes redirecttest.html?a=10&b=20 redirect to redirecttest@a=10&b=20.html