https://stackoverflow.com/questions/40871983/rewritecond-comparing-two-variables-in-apache-htaccess ----------------------------------------------------------------------------- In RewriteCond you cannot use a variable on right hand side. You have to use it like this: RewriteCond %{HTTP_HOST}##%{HTTP:Origin} ^(.+)##http://\1(/|$) Here are are joining 2 variables using a delimiter ## (it can be anything). Then on RHS we match and capture value before ## that represents HTTP_HOST. After ## using a back-reference \1 we do our matching.