Re: Stripping query string except from specific URL

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

 





On Wed, Apr 24, 2024 at 12:43 PM Dave Wreski <dwreski@xxxxxxxxxxxxxxxxxxx.invalid> wrote:

Hi,

We have a situation where we need to strip a query string from all URLs except ones matching a particular pattern. However, when I try the rules below, it redirects to the homepage for some reason.

In this example, I'd like to strip off the query string from all URLs except those involving /resources/blog:

RewriteCond %{REQUEST_URI} !/resources/blog
RewriteCond %{QUERY_STRING} ^start=
RewriteRule (.*)       https://guardiandigital.com$1    [L,QSD]

What am I missing?

Thanks,
Dave



To remove the query string, see the QSD flag, or append a ? at the end of the target.

That's what I'm doing, I think. What am I missing? It just redirects to the homepage somehow.

Shouldn't I be able to stack RewriteConds in this way, followed by a RewriteRule?

I have no idea what could be wrong.



Test with curl, and see if you get redirected after the fact. 

[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