I have an iframe to embed audio which points to a src like this…
http://domain.com/embed/mediaID
At the embed level I have an index.php listening to GET requests but it will of course never get the requests unless I do some sort of redirect in my .htaccess like so…
RewriteEngine On
RewriteRule ^([^/]*)$ index.php?var1=$1 [L]
That accounts for the path schema so I can point to a mediaID like that but this is unscalable in that I can’t easily add more GET params.
I’m seeing that YouTube & Vimeo point to a mediaID but then also allow GET params thereafter.
My understanding is that a rewrite is the way to go for this but perhaps I’m mistaken. I definitely would rather pass the mediaID as a GET param and skip writing each param I’ll ever use in the .htaccess but that is not the way YouTube & Vimeo have gone, they seem to have found a scalable way to do it.
Why is their approach of pointing to the mediaID better than passing the url as a GET? I take it their approach is good practice, perhaps I’m assuming to much.
What is the best way to accomplish a direct link to a media ID and retain the GET params in a scalable way.
If you want to retain the existing query string after your rewrite, just use the
QSAflag on your rule:Then, in addition to
var1, you’ll receive whichever parameters were passed in as part of the original request.