|
|
|
|
||||||
| comp.info.servers.unix Web servers for UNIX platforms. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
In .htaccess, we can use
SetEnvIfNoCase Referer "^http://mywebsite\.com/" local_ref=1 But how can we specify *.mywebsite.com? For example, content.mywebsite.com web.mywebsite.com pub.mywebsite.com company.mywebsite.com It seems that SetEnvIfNoCase Referer "^http://*\.mywebsite\.com/" local_ref=1 or SetEnvIfNoCase Referer "^http://\*\.mywebsite\.com/" local_ref=1 doesn't work. Thanks in advance. |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
licheng <lichengNoSpam@pchome.com.tw> posted:
> In .htaccess, we can use > > SetEnvIfNoCase Referer "^http://mywebsite\.com/" local_ref=1 > > But how can we specify *.mywebsite.com? For example, > > content.mywebsite.com > web.mywebsite.com > pub.mywebsite.com > company.mywebsite.com The dot is a wildcard in regex expressions, itself. You don't need the asterisk for that sort of thing. > It seems that > > SetEnvIfNoCase Referer "^http://*\.mywebsite\.com/" local_ref=1 > > or > > SetEnvIfNoCase Referer "^http://\*\.mywebsite\.com/" local_ref=1 > > doesn't work. That's because the backslash in front of the dot escapes it so that it's only treated as a dot rather than a wildcard, and you've started the pattern matching before it. Try: SetEnvIfNoCase Referer ".mywebsite\.com/" local_ref=1 NB: That's an untested example, but it means to match with a referrer in this sort of fashion *mywebsite.com* (i.e. doesn't care what it starts with or ends with, as long as that's in there somewhere). -- If you insist on e-mailing me, use the reply-to address (it's real but temporary). But please reply to the group, like you're supposed to. This message was sent without a virus, please delete some files yourself. |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
On Fri, 18 Mar 2005 19:55:06 +1030, Tim <tim@mail.localhost.invalid>
wrote: >> In .htaccess, we can use >> SetEnvIfNoCase Referer "^http://mywebsite\.com/" local_ref=1 >> But how can we specify *.mywebsite.com? For example, >> content.mywebsite.com >> web.mywebsite.com >> pub.mywebsite.com >> company.mywebsite.com >The dot is a wildcard in regex expressions, itself. You don't need the >asterisk for that sort of thing. So the correct syntax is ...? SetEnvIfNoCase Referer "^http://.mywebsite\.com/" local_ref=1 or SetEnvIfNoCase Referer "^http://.\.mywebsite\.com/" local_ref=1 doesn't work, neither. Thanks in advance. |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
Unattributed authors wrote:
>>> In .htaccess, we can use >>> SetEnvIfNoCase Referer "^http://mywebsite\.com/" local_ref=1 >>> But how can we specify *.mywebsite.com? For example, >>> content.mywebsite.com >>> web.mywebsite.com >>> pub.mywebsite.com >>> company.mywebsite.com Tim <tim@mail.localhost.invalid> >> The dot is a wildcard in regex expressions, itself. You don't need the >> asterisk for that sort of thing. licheng <lichengNoSpam@pchome.com.tw> posted: > So the correct syntax is ...? Regex ain't my forte, but I think the answer might be to use .* where you'd use * as a DOS type of wildcard. (Dot being a wildcard for a single character where the dot is, * being a ***quantifier*** for 0 or more of the preceeding.) e.g. SetEnvIfNoCase Referer ".*mywebsite\.com.*" local_ref=1 Though why still persist with starting with http://, instead of just looking for mywebsite.com by itself? i.e. > SetEnvIfNoCase Referer "^http://.mywebsite\.com/" local_ref=1 > SetEnvIfNoCase Referer "^http://.\.mywebsite\.com/" local_ref=1 Precluding the ^ [start with] "http://" preamble, and not insisting on a trailing slash after the domain, might simplify things. Looking at the mod_rewrite page of the Apache documents, you might be able to do something like this: "^http://www|web|pub|company\.mywebsite.\com" if you wanted more specific matching. Just off the top of my head, I can't think of a simple way to test wildcard referrer rules without having access to several domain names to throw at my webserver. So this is all just theoretical. NB: I do hope you realise that if you insist browsers have your site as their referer that it's going to harm some people's use of it. The initial visit to the site won't have that in the referrer, and only some clients will provide a referrer as they browse around. And some privacy zealots will include fake referrer data rather than leave it blank. -- If you insist on e-mailing me, use the reply-to address (it's real but temporary). But please reply to the group, like you're supposed to. This message was sent without a virus, please delete some files yourself. |
|
![]() |
| Outils de la discussion | |
|
|