0

I want to redirect a specific page to home page.

My source URL is http://examlple.com/index.html?page=22

My target URL is http://examlple.com/

I have tried Redirect /index.html?page=22 http://example.com/

also I have tried by using 301 and RewriteRule but no success yet, this is not working.

Amit Verma
  • 40,709
  • 21
  • 93
  • 115
psanjib
  • 1,255
  • 2
  • 15
  • 24
  • 1
    Possible duplicate of [How redirect specific url using htaccess rewrite rules](http://stackoverflow.com/questions/19466146/how-redirect-specific-url-using-htaccess-rewrite-rules) – try-catch-finally Nov 19 '15 at 07:09

1 Answers1

0

You can't match against querystrings in Redirect directive.

Try mod_rewrite

RewriteEngine on

RewriteCond %{QUERY_STRING} ^page=22$
RewriteRule ^index\.html$ http://example.com/? [NC,L,R]

Empty question ? mark at the end is important as it will discard the original query string from url.

Amit Verma
  • 40,709
  • 21
  • 93
  • 115