You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Andrea Rossignoli <so...@polin.it> on 2003/03/10 20:16:07 UTC

Re: [users@httpd] Need help with a RewriteCond Statement (http/https)

Hi,

from a regular expressions point of view the syntax is:

https?

the ? before the s means that the s is optional,
so in that case http and https a both matched.

I have many doubts about the first rule you wrote,
did you test them ?

So If understand your needs,
I'd write:

RewriteCond %{HTTP_REFERER} !^https?://.*(sample_text|sample_numeric)$ [NC]



:-) Andrea



----- Original Message -----
From: "Mike" <mi...@levrah.net>
To: <us...@httpd.apache.org>
Sent: Thursday, April 10, 2003 18:10
Subject: [users@httpd] Need help with a RewriteCond Statement (http/https)


> Hello.
>
> I have a question about a RewriteCond statement.
>
> I'm not sure how to do it, but I would like to change the following
> one-liner - where the "http://" portion is located - to have it recognize
> either or both non-ssl (http://) and ssl (https://).
>
> RewriteCond %{HTTP_REFERER}
> !^($|(http://)?[^/]*(sample_text|sample_numeric)) [NC]
>
> I'm thinking it may be this, but I am unsure.
>
> RewriteCond %{HTTP_REFERER}
> !^($|(http://|https://)?[^/]*(sample_text|sample_numeric)) [NC]
>
> Can someone help me with that please...
>
> Thanks.
> -mike
>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Need help with a RewriteCond Statement (http/https)

Posted by Mike <mi...@levrah.net>.
Andrea.

Just a quick follow-up. "...https?..." did in fact work. Thanks so much.

(for everyone else, pardon the excess use of bandwidth just for a thank 
you, but thank you's come few and far between too often in today's world. 
Thanks again Andrea)

-mike

At 02:16 PM 3/10/2003, you wrote:
>Hi,
>
>from a regular expressions point of view the syntax is:
>
>https?
>
>the ? before the s means that the s is optional,
>so in that case http and https a both matched.
>
>I have many doubts about the first rule you wrote,
>did you test them ?
>
>So If understand your needs,
>I'd write:
>
>RewriteCond %{HTTP_REFERER} !^https?://.*(sample_text|sample_numeric)$ [NC]
>
>
>
>:-) Andrea


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Need help with a RewriteCond Statement (http/https)

Posted by Mike <mi...@levrah.net>.
Hi Andrea.

Thanks. I'll test it here in a second. But wanted to answer your question. 
Yes. The pasted rule (with the exception of the literals "sample text" and 
"sample numeric") came from an actively used rule; one that's been in-use 
for quite a good long while. It may be that it's been used for so long that 
it's "technically out-dated" now? That's entirely possible...

Going to test out "...https?..." in a few...

Thanks!
-mike

At 02:16 PM 3/10/2003, you wrote:
>Hi,
>
>from a regular expressions point of view the syntax is:
>
>https?
>
>the ? before the s means that the s is optional,
>so in that case http and https a both matched.
>
>I have many doubts about the first rule you wrote,
>did you test them ?
>
>So If understand your needs,
>I'd write:
>
>RewriteCond %{HTTP_REFERER} !^https?://.*(sample_text|sample_numeric)$ [NC]
>
>
>
>:-) Andrea
>
>
>
>----- Original Message -----
>From: "Mike" <mi...@levrah.net>
>To: <us...@httpd.apache.org>
>Sent: Thursday, April 10, 2003 18:10
>Subject: [users@httpd] Need help with a RewriteCond Statement (http/https)
>
>
> > Hello.
> >
> > I have a question about a RewriteCond statement.
> >
> > I'm not sure how to do it, but I would like to change the following
> > one-liner - where the "http://" portion is located - to have it recognize
> > either or both non-ssl (http://) and ssl (https://).
> >
> > RewriteCond %{HTTP_REFERER}
> > !^($|(http://)?[^/]*(sample_text|sample_numeric)) [NC]
> >
> > I'm thinking it may be this, but I am unsure.
> >
> > RewriteCond %{HTTP_REFERER}
> > !^($|(http://|https://)?[^/]*(sample_text|sample_numeric)) [NC]
> >
> > Can someone help me with that please...
> >
> > Thanks.
> > -mike


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org