Tuesday, April 16, 2013

IBM HTTP Server: redirect non https request to https


Listen 80

LoadModule rewrite_module modules/mod_rewrite.so

<VirtualHost *:80>
    ServerName myserver.goweekend.ca
    RewriteEngine on
    RewriteCond %{SERVER_PORT} !^443$
    RewriteRule ^/(.*)$ https://myserver.goweekend.ca/$1 [R]
    RewriteLogLevel 0
    RewriteLog logs/rewrite.log
</VirtualHost>


Problem:
Invalid command 'RewriteLog', perhaps misspelled or defined by a module not included in the server configuration
or
Invalid command 'RewriteLogLevel', perhaps misspelled or defined by a module not included in the server configuration

Since Apache httpd 2.4 mod_rewrite RewriteLog and RewriteLogLevel directives has been completely replaced by the new per-module logging configuration.

<VirtualHost *:80>
    ServerName myserver.goweekend.ca
    RewriteEngine on
    RewriteCond %{SERVER_PORT} !^443$
    RewriteRule ^/(.*)$ https://myserver.goweekend.ca/$1 [R]
    LogLevel alert rewrite:trace6
</VirtualHost>

No comments:

Post a Comment