Question about RewriteRule and HTTP_HOST server variable
Posted
by SeancoJr
on Server Fault
See other posts from Server Fault
or by SeancoJr
Published on 2009-12-29T11:16:44Z
Indexed on
2010/04/20
0:03 UTC
Read the original article
Hit count: 270
In evaluating a rewrite rule that redirects to a specific URL and say the rewrite condition is met, would it be possible to use HTTP_HOST as part of the URL to be redirected to?
Example in question:
RewriteRule .*\.(jpg|jpe?g|gif|png|bmp)$ http://%{HTTP_HOST}/no-leech.jpg [R,NC]
The motive behind this question is a desire to create a single htaccess file that would match against an addon domain (on a shared hosting account) and an infinite amount of subdomains below it to prevent hotlinking of images.
© Server Fault or respective owner