httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Tonhofer <el.to...@m-plify.net>
Subject RE: [users@httpd] Easy(?) mod_rewrite question
Date Fri, 06 Jun 2003 19:31:06 GMT
Hi zeek,

Do your rules actually work? I expect $2 to always be the empty
string (there is nothing on the left-hand-side to bind to)

So the rewriting would do this:

/sqmail           -rewritten to->   a redirection to https://zero//
/sqmail/          -rewritten to->   a redirection to https://zero//
/sqmailfoobar     -rewritten to->   a redirection to https://zero/foobar/
/sqmail/foobar    -rewritten to->   a redirection to https://zero/foobar/

..which is probably not what you want. You probably want:

RewriteRule ^/sqmail/(.*)$      https://zero/sqmail/$1 [L,R=301]
RewriteRule ^/sqmail$           https://zero/sqmail/   [L,R=301]

I like to separate cases into several lines. In that case:

/sqmail           -rewritten to->   a redirection to https://zero/sqmail/
/sqmail/          -rewritten to->   a redirection to https://zero/sqmail/
/sqmailfoobar     no match
/sqmail/foobar    -rewritten to->   a redirection to 
https://zero/sqmail/foobar/

...or am I confused?

Best regards,

	-- David

P.S. I still haven't solved my first problem, of course :-)
     Anyway, the beer garden beckons!!



--On Thursday, June 05, 2003 1:38 PM -0400 zeek <zeek@sparklehouse.com> 
wrote:

>
> David,
>
> Your post here actually helped me figure out a long standing problem. I
> only recently leaped into the world of the RewriteEngine and it's really
> quite a science. Basically what I was trying to do is Redirect/Rewrite
> what was an Alias to an Directory outside DocumentRoot. It took me way
> too long to get the logic of this :-)
>
> What I extracted from your rule below is this:
>
> RewriteEngine On
> RewriteRule ^/sqmail/?(.*)      https://zero/$1/$2 [L,R=301]
> RewriteRule ^/webmail/?(.*)     https://zero/$1/$2 [L,R=301]
>
> Within a VirtualHost directive <VirtualHost _default_:443> I have the
> following:
>
> Alias /sqmail /usr/share/squirrelmail/
> Alias /webmail /usr/share/squirrelmail/
>
> <Directory "/usr/share/squirrelmail">
>     SSLOptions +StdEnvVars
> </Directory>
>
> ---
>
> The only way this might help you is by noting the $2 in the initial
> rewrite rule above. Could you somehow pass this to preserve
> token.cgi?a=cfmpw&t=fsSd%40ZkT
>
> This rewrite stuff is total insanity at first --a lot of trial/error.
>
> Hope this helps a little... good luck! And thanks for your post!
>
> cheers,
> -zeek
>
>> -----Original Message-----
>> From: David Tonhofer [mailto:el.tonno@m-plify.net]
>> Sent: Thursday, June 05, 2003 9:55 AM
>> To: users@httpd.apache.org
>> Subject: [users@httpd] Easy(?) mod_rewrite question
>>
>>
>> Hi people,
>>
>> Just this: how do I tell mod_rewrite to URL-encode (escape) its
>> rewritten URLs? Here's the case:
>>
>> We want to redirect everything to an SSL-ed site:
>>
>>     RewriteEngine On
>>     RewriteRule ^/(.*) https://secure.host.com/$1 [L,R=301]
>>
>> But now a Bugzilla URL comes your way:
>>
>>     /bugzilla/token.cgi?a=cfmpw&t=fsSd%40ZkT
>>
>> and it is rewritten,giving an access to the SSL-ed site but with
>> the '%' escaped, i.e. the path becomes:
>>
>>     /bugzilla/token.cgi?a=cfmpw&t=fsSd%2540ZkT
>>
>> Which causes Bad Boss Looks and other trouble. Does anyone know a
>> workaround?
>>
>> Best regards,
>>
>> 	--David
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> 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


Mime
View raw message