0

I am trying to redirect url using this condition

RewriteCond %{HTTP_HOST} ^www.example.com/xyz/Pianos-212--0$
RewriteRule ^(.*)$ http://www.example.com/xyz/Pianos-212/ [R=301,L]

the output i get is this

www.example.com/xyz/Pianos-212/?getCategory=$1&getBrand=$2

I need output URL to look like this

http://www.example.com/xyz/Pianos-212/

I am sure there is one line written above my condition that looks like this

RewriteRule ".*-([0-9]+)-.*-([0-9]+)" category.php?getCategory=$1&getBrand=$2 [L]

It is automatically appending query string after rewritten url

markwatsonatx
  • 3,391
  • 2
  • 21
  • 19
Sandeep Pujare
  • 147
  • 2
  • 11

1 Answers1

0

Try adding a ? to the end of your RewriteRule:

RewriteRule ^(.*)$ http://www.example.com/xyz/Pianos-212? [R=301,L]

See this answer for more information:

htaccess 301 redirect - Remove query string (QSA)

Community
  • 1
  • 1
markwatsonatx
  • 3,391
  • 2
  • 21
  • 19
  • Thanks for the reaply. Do you think its SEO friendly with ? at the end of the URL? – Sandeep Pujare Apr 16 '16 at 05:48
  • I'm not sure if the ? will actually be included after the rewrite. You can read more here: http://httpd.apache.org/docs/current/mod/mod_rewrite.html - search for "Modifying the Query String". – markwatsonatx Apr 16 '16 at 05:57