Apache 2.4 Rewrite rule based on Header value

by Rajesh   Last Updated July 11, 2019 20:00 PM

trying to do http to https based on header value of the request but failing some how.can some one help me here.

request is if a header value is xyz and it is equal to Y then server http pages,for all other requests server https pages. immediately i have another condition inside proxy module which has to be executed but it is failing to execute. also unable to see Log traces for rewrite in error logs.

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP:xyz} !=Y [NC] --> if header contains xyz and its value is not equal to Y
    Rewrite ^/?(.*) https://%{SERVER_NME}/$1 [R,L] --> server https page.
    LogLevel alert mod_rewrite.c:trace3 --> Log the rewrite activity.

<IfModule mod_proxy_http.c> --> after above activity is completed continue this activity.
    RewriteCond ... 
    RewriteCond ...
    RewriteRule ...

Apache Version : 2.4

Related Questions

Updated November 06, 2017 22:00 PM

Updated November 12, 2018 19:00 PM

Updated January 13, 2017 01:00 AM

Updated June 18, 2017 17:00 PM

Updated March 31, 2018 19:00 PM