[users@httpd] Stripping query string except from specific URL

2024-04-19 Thread Dave Wreski

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



Re: [users@httpd] Stripping query string except from specific URL

2024-04-19 Thread Frank Gingras
On Fri, Apr 19, 2024 at 11:16 AM Dave Wreski
 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.