karmany  
karmany  

Reputation: 39

htaccess redirect: "example.com/?deletethis" to "example.com"

I've trying to redirect (with .htaccess file) this: http://www.example.com/?deletethis to: http://example.com

I try this: RewriteEngine On

RewriteCond %{QUERY_STRING} deletethis [NC]
RewriteRule . http://example.com/? [R=301,L]

But doesn't work, I try this: RewriteEngine On

Redirect 301 /?deletethis http://example.com

But doesn't work either.

Upvotes: 0

Views: 26

Answers (1)

Rahil Wazir
Rahil Wazir

Reputation: 10132

Try this:

RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_STRING} deletethis [NC]
RewriteRule ^ http://example.com/? [R=301,L]

Replace . with ^

Upvotes: 1

Related Questions