httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kurtis Rader <kra...@skepticism.us>
Subject Re: [users@httpd] Re: Removing query string through .htaccess
Date Fri, 22 May 2015 01:47:07 GMT
On Thu, May 21, 2015 at 6:18 AM, Bob <bobnlinux@gmail.com> wrote:

>
> I'm also successful with following but goes to home page, can't preserve
> the actual link
>
> RewriteCond %{THE_REQUEST} \?[^\ ]+
> RewriteRule (.*) /$1? [R=302,L]


Works for me. Although I would write the rule like this

RewriteCond %{QUERY_STRING} !=""
RewriteRule ^ %{REQUEST_URI}? [R=302,L]


When I issue a "GET /hello.php?whatever=1" with either version I get a 302
response with

Location: http://www.skepticism.us/hello.php

Also, if you don't want to match non-whitespace I recommend \S rather than [^\
].

-- 
Kurtis Rader
Caretaker of the exceptional canines Junior and Hank

Mime
View raw message