1

I have a Website which gives Youtube Video download links. I have a Domain like xxyoutube.com. I want to redirect www.xxyoutube.com/watch?v=abcdef to www.xxyoutube.com/watch/abcdef. I used some htacces modrewrite Commands but the "question mark" give me a big problem while using that commands. I need your kindly help. I need rewrite code to redirect first url to second url.

  • possible duplicate of [.htaccess rewrite URL with a question mark "?"](http://stackoverflow.com/questions/18543194/htaccess-rewrite-url-with-a-question-mark) – Croises Nov 09 '14 at 15:47

1 Answers1

0

You can use this code in your DOCUMENT_ROOT/.htaccess file:

RewriteEngine On
RewriteBase /

RewriteCond %{THE_REQUEST} \s/+watch\?v=([^\s&]+) [NC]
RewriteRule ^ watch/%1? [R=302,L]

RewriteRule ^watch/([^/]+)/?$ watch?v=$1 [L,QSA,NC]
anubhava
  • 761,203
  • 64
  • 569
  • 643