Re: Removing query string through .htaccess

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

 



Hello Kurtis,

Thanks for your kind response. I have tried your rule sets but unfortunately it is working as before.

i.e. http://mydomain.com/page1/?xyz and http://mydomain.com/page1?xyz both redirect to http://mydomain.com


> On Fri, May 22, 2015 at 1:47 AM, Kurtis Rader <krader@xxxxxxxxxxxxx> wrote:
> On Thu, May 21, 2015 at 6:18 AM, Bob <bobnlinux@xxxxxxxxx> 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

> On Thu, 21 May 2015 13:18:49 +0000
> Bob <bobnlinux@xxxxxxxxx> 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]
> 
> 
> On Thu, 21 May 2015 12:23:42 +0000
> Bob <bobnlinux@xxxxxxxxx> wrote:
> 
> > Hello All,
> > 
> > I have already gone through a no. of links for removing query strings and till now all are going back to domain.
> > The one I'm using presently is
> > 
> > ``````````````
> > RewriteCond %{QUERY_STRING} .
> > RewriteRule ^$ /? [R=302,L]
> > 
> > `````````````````````
> > 
> > As obvious the above goes back to homepage, but is there any rule set which just remove the query string and keep the url intact ?
> > 
> > like http://mywxample.com/any_page/?xyz should be changed as http://mywxample.com/any_page
> > 
> > Any help is very much appreciated.
> > 
> > with regards,
> > Bob

---------------------------------------------------------------------
To unsubscribe, e-mail: users-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