Mobile app version of vmapp.org
Login or Join
Ravi8258870

: Mod Rewrite question Is there a way to rewrite http://localhost/embed/player.swf?file=http://www.youtube.com/watch?v=7yKDhm4_-90 to something smaller? or is there a way to change this into http://localhost/embed/script.php?id=7yKDhm4

@Ravi8258870

Posted in: #Apache #Htaccess #Localhost #ModRewrite #Php

Is there a way to rewrite
localhost/embed/player.swf?file=http://www.youtube.com/watch?v=7yKDhm4_-90

to something smaller?

or is there a way to change this into
localhost/embed/script.php?id=7yKDhm4_-90

What can i do?

UPDATE

i've tried with something like this:

header('Content-type: application/x-shockwave-flash');
header('Content-Length: ' . filesize($file));
header('Connection: close');
$video_id = $_REQUEST['id'];
$content = readfile("http://localhost/embed/player.swf?file=http://www.youtube.com/watch?v=$video_id");
echo $content;


but it is mot working.

what i am doing wrong?

10.03% popularity Vote Up Vote Down


Login to follow query

More posts by @Ravi8258870

3 Comments

Sorted by latest first Latest Oldest Best

 

@Cugini213

Try the simple and easy solution no need to specify headers

<?php if ($_REQUEST['id']): ?> // youtube video id

<iframe class="youtube-player" type="text/html" width="640" height="385" src="http://www.youtube.com/embed/<?php echo $_REQUEST['id']; ?>" frameborder="0">
</iframe>

<?php endif; ?>

10% popularity Vote Up Vote Down


 

@Steve110

Try something like the following in the .htaccess file (create it if it doesn't already exist) in your website's root directory:

RewriteRule ^embed/player.swf?file=([0-9a-zA-Z0-9]+) embed/player.swf?file=http://www.youtube.com/watch?v= [L]

10% popularity Vote Up Vote Down


 

@Kevin317

it should be possible with either method; I'll post a possible PHP solution.

include("player.swf?file=http://www.youtube.com/watch?v={$_GET['id']}");


This is a very simplified solution, so you would still have to handle filtering your input, escaping output, and empty IDs if you wanted to use it in a production environment.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme