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 ...
<Ifmodule>
<IfModule>

Apache Version : 2.4



Related Questions


Apache Reverse Proxy Caching

Updated November 06, 2017 22:00 PM

Configuration or command to see ssl certificate

Updated November 12, 2018 19:00 PM

htaccess not working at apache 2.4 virtual host

Updated January 13, 2017 01:00 AM


Apache never wants to run my python scripts

Updated March 31, 2018 19:00 PM