You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Glenn Gillis <gl...@elaw.org> on 2010/04/19 23:44:58 UTC

[users@httpd] Rewrite rule rewriting unexpectedly

Would any rewriting gurus out there care to speculate why the rewrite rule:

  "RewriteRule /blog http://spotlight.wordpress.com/"

would cause the image URL:

  "<img src="/system/files/images_content/blogspot_final_framed_0.jpg"
  alt="what we do" width="500" height="125" />"

to redirect to the spotlight.wordpress.com webpage?

Running Apache 2.2.9 on FreeBSD 6.x.
-- 
Thanks!

Glenn Gillis
Information Technology Manager
Environmental Law Alliance Worldwide
U.S. Office
http://www.elaw.org

Re: [users@httpd] Rewrite rule rewriting unexpectedly

Posted by Glenn Gillis <gl...@elaw.org>.
Eric Covener wrote, On 4/19/2010 2:59 PM:
> On Mon, Apr 19, 2010 at 5:44 PM, Glenn Gillis <gl...@elaw.org> wrote:
>> Would any rewriting gurus out there care to speculate why the rewrite rule:
>>
>>  "RewriteRule /blog http://spotlight.wordpress.com/"
>>
>> would cause the image URL:
>>
>>  "<img src="/system/files/images_content/blogspot_final_framed_0.jpg"
>>  alt="what we do" width="500" height="125" />"
>>
>> to redirect to the spotlight.wordpress.com webpage?
>>
>> Running Apache 2.2.9 on FreeBSD 6.x.
> 
> If you want to match exactly "/blog" and not that string inside the
> URL, you need to anchor it with e.g. ^/blog$

Thanks, that works!

I believe I had tried it with just ^/blog and just /blog$ but not with ^/blog$.
-- 
Glenn

Re: [users@httpd] Rewrite rule rewriting unexpectedly

Posted by Jonathan Zuckerman <j....@gmail.com>.
On Mon, Apr 19, 2010 at 5:59 PM, Eric Covener <co...@gmail.com> wrote:

> On Mon, Apr 19, 2010 at 5:44 PM, Glenn Gillis <gl...@elaw.org> wrote:
> > Would any rewriting gurus out there care to speculate why the rewrite
> rule:
> >
> >  "RewriteRule /blog http://spotlight.wordpress.com/"
> >
> > would cause the image URL:
> >
> >  "<img src="/system/files/images_content/blogspot_final_framed_0.jpg"
> >  alt="what we do" width="500" height="125" />"
> >
> > to redirect to the spotlight.wordpress.com webpage?
> >
> > Running Apache 2.2.9 on FreeBSD 6.x.
>
> If you want to match exactly "/blog" and not that string inside the
> URL, you need to anchor it with e.g. ^/blog$
>
> --
> Eric Covener
> covener@gmail.com
>
> ---------------------------------------------------------------------
> 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
>
>
because!  regular expressions are by definition greedy, which means they
will match the largest possible string of characters.  If you don't give it
boundaries like the start and end string delimiters it just sucks up
everything that it can.

Re: [users@httpd] Rewrite rule rewriting unexpectedly

Posted by Eric Covener <co...@gmail.com>.
On Mon, Apr 19, 2010 at 5:44 PM, Glenn Gillis <gl...@elaw.org> wrote:
> Would any rewriting gurus out there care to speculate why the rewrite rule:
>
>  "RewriteRule /blog http://spotlight.wordpress.com/"
>
> would cause the image URL:
>
>  "<img src="/system/files/images_content/blogspot_final_framed_0.jpg"
>  alt="what we do" width="500" height="125" />"
>
> to redirect to the spotlight.wordpress.com webpage?
>
> Running Apache 2.2.9 on FreeBSD 6.x.

If you want to match exactly "/blog" and not that string inside the
URL, you need to anchor it with e.g. ^/blog$

-- 
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
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