You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by "Sennott, Mark" <MS...@Tribune.com> on 2007/09/04 18:32:34 UTC
[users@httpd] mod_rewrite: how to discard tail of the URL?
I'm running RHEL4 update 3 with Apache/2.2.4
I want to redirect this:
http://foo.bar.com/search/search-events.front?keywords=&x=35&y=6
to this:
http://foo.bar.com/events/
I am using this rewrite rule:
RewriteCond %{HTTP_HOST} ^foo.bar.com$
RewriteRule ^/search/search-events(.*) http://foo.bar.com/events/ [L]
The problem is that the redirect returns this:
/events/?keywords=&x=35&y=6
How the heck do I discard the tail end of the URL??
RE: [users@httpd] mod_rewrite: how to discard tail of the URL?
Posted by "Sennott, Mark" <MS...@Tribune.com>.
Thanks for the help Joshua. I didn't even think about the ?... As being
treated differently because it's a query string.
-----Original Message-----
From: jslive@gmail.com [mailto:jslive@gmail.com] On Behalf Of Joshua
Slive
Sent: Tuesday, September 04, 2007 12:24 PM
To: users@httpd.apache.org
Subject: Re: [users@httpd] mod_rewrite: how to discard tail of the URL?
On 9/4/07, Sennott, Mark <MS...@tribune.com> wrote:
>
>
> I'm running RHEL4 update 3 with Apache/2.2.4
>
> I want to redirect this:
>
> http://foo.bar.com/search/search-events.front?keywords=&x=35&y=6
>
> to this:
>
> http://foo.bar.com/events/
>
>
> I am using this rewrite rule:
>
> RewriteCond %{HTTP_HOST} ^foo.bar.com$ RewriteRule
> ^/search/search-events(.*) http://foo.bar.com/events/ [L]
>
>
> The problem is that the redirect returns this:
>
> /events/?keywords=&x=35&y=6
>
>
>
> How the heck do I discard the tail end of the URL??
Add a ? to the end of the substitution string. See:
http://wiki.apache.org/httpd/RewriteQueryString
http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewriterule
(the box: "Modifying the Query String").
Joshua.
---------------------------------------------------------------------
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] mod_rewrite: how to discard tail of the URL?
Posted by Joshua Slive <jo...@slive.ca>.
On 9/4/07, Sennott, Mark <MS...@tribune.com> wrote:
>
>
> I'm running RHEL4 update 3 with Apache/2.2.4
>
> I want to redirect this:
>
> http://foo.bar.com/search/search-events.front?keywords=&x=35&y=6
>
> to this:
>
> http://foo.bar.com/events/
>
>
> I am using this rewrite rule:
>
> RewriteCond %{HTTP_HOST} ^foo.bar.com$
> RewriteRule ^/search/search-events(.*) http://foo.bar.com/events/ [L]
>
>
> The problem is that the redirect returns this:
>
> /events/?keywords=&x=35&y=6
>
>
>
> How the heck do I discard the tail end of the URL??
Add a ? to the end of the substitution string. See:
http://wiki.apache.org/httpd/RewriteQueryString
http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewriterule
(the box: "Modifying the Query String").
Joshua.
---------------------------------------------------------------------
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