Reputation: 343
I tried the following but does not seem to work:
# IF HTTP_HOST != SERVER_NAME DO 403
RewriteCond %{HTTP_HOST} !%{SERVER_NAME} [NC]
RewriteRule .* - [F,L]
Upvotes: 1
Views: 613
Reputation: 785146
You cannot use a variable on RHS of RewriteCond
. Use it like this:
RewriteCond %{SERVER_NAME}#%{HTTP_HOST} ^(?:www\.)?([^#]+)#(?!(www\.)?\1).* [NC]
RewriteRule .* - [F,L]
Upvotes: 1