Forum Moderators: phranque

Message Too Old, No Replies

Using rewrite with HTTPS

         

txtoolman

5:51 pm on Jun 23, 2006 (gmt 0)

10+ Year Member



I have part of my rewrite statments going, but I hav enot been able to figure this one out: I want to only accept referrals from an https:// page (on another server). Here's what I have so far:

RewriteEngine on
RewriteCond %{HTTP_REFERER}!^http://server1.com.*$ [NC]
RewriteCond %{HTTP_REFERER}!^http://server2.com.*$ [NC]
RewriteCond %{HTTPS} [OR]
RewriteCond %{HTTP_REFERER}!^https://server3.com.*$ [NC]
RewriteRule ^.*$ - [F]

Thanks for any input

txtoolman

6:26 pm on Jun 23, 2006 (gmt 0)

10+ Year Member



I believe I found my own answer. I was missing a single character. Here is the updated code:

RewriteEngine on
RewriteCond %{HTTP_REFERER}!^http://server1.com.*$ [NC]
RewriteCond %{HTTP_REFERER}!^http://server2.com.*$ [NC]
RewriteCond %{HTTPS} .[OR]
RewriteCond %{HTTP_REFERER}!^https://server3.com.*$ [NC]
RewriteRule ^.*$ - [F]

I was missing the " . " in the 4th line.

I do have another question while on the rewrite topic -- which variable should I be testing for if I want to grant access to this same area, if it is being redirected from another server (specifically an IIS server)? I tried the HTTP_FORWARDED but no luck.