Forum Moderators: phranque

Message Too Old, No Replies

Rewrite broken embedded YouTube links

         

batface

8:30 pm on Nov 17, 2011 (gmt 0)

10+ Year Member



I have looked around but have absolutely no idea how to do a rewrite of the following type URLs

http://www.example.com/video/filesrep/vid/\'http://www.youtube.com/watch?v=6wq88TXU_1A&feature=player_embedded%5C'

There are about 1,000 of them and I want to rewrite to http://www.example.com/video/

Is the query string handled in a similar way to a 'normal' URL and do I treat the second URL as just a string - part of the main URL?

phranque

10:42 am on Nov 18, 2011 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



i doubt that is a valid url, but:

everything after the "?" in a url is the query string.
you will have to use a RewriteCond directive to capture from the QUERY_STRING server variable the part of the requested url you wish to use for the redirection url.

mod_rewrite:
http://httpd.apache.org/docs/current/mod/mod_rewrite.html [httpd.apache.org]

i'm guessing your problem is actually that you have several unencoded reserved and unsafe characters in the url.
after percent-encoding the question mark in the "youtube url" you will no longer have a query string in your url.

lucy24

2:28 am on Nov 19, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I am especially intrigued by the "frame":

\'{blahblah}%5C'

Quick detour to Character Viewer tells me that %5C is the backslash. So how did it get nicely encoded when nothing else did?

You've got two nested "packages": the part I just noticed, and the inner part with the query string. Which part do you want to rewrite? Do you want to capture either part, or throw everything away?

And, for that matter, do do you want to rewrite? You're looking, er, Milliplicate Content if so. Did you mean redirect?