RE: mod_rewrite: how to discard tail of the URL?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx [mailto:jslive@xxxxxxxxx] On Behalf Of Joshua
Slive
Sent: Tuesday, September 04, 2007 12:24 PM
To: users@xxxxxxxxxxxxxxxx
Subject: Re:  mod_rewrite: how to discard tail of the URL?

On 9/4/07, Sennott, Mark <MSennott@xxxxxxxxxxx> 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@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx

---------------------------------------------------------------------
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@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux