php - RewriteCond: any workaround to match the HTTP_REFERER with HTTP_HOST? -
1) need verify whether connections referred same site or else. 2) can not type http_host manually because .htaccess file meant handled subversion , shared across different development environments different http_host values
so goal find workaround make condition work transparently no matter environment is, , keep htaccess handled svn without need of manual fixes.
thanks!
with apache 2 can this:
rewritecond %{http_referer} ^$ [or] rewritecond %{http_referer} ^[^:/?#]+://([^/?#]+) # authority rewritecond %1 ^(?:(?:[a-za-z0-9-._~!$&'()*+,;=:]|%[0-9a-fa-f]{2})*@)?((?:[a-za-z0-9-._~!$&'()*+,;=]|%[0-9a-fa-f]{2})*)(?::\d+)?$ # host name rewritecond %1/%{http_host} !^([^/]+)/\1$ # compare http_host rewriterule ^ …
note http_host can empty in case of pre-http/1.1 request.
Comments
Post a Comment