Page 1 of 1

pass an complete url then the ? simbol using mod_rewrite

Posted: Fri Nov 03, 2006 1:41 pm
by visonardo
hi, i want do like http://anonym.to/?http://www.google.com (I used google in this example)

but to use this anonym.to service you pass your url you want then the ? without change in that and done. I tested doing something thus

Code: Select all

RewriteRule ^(wp7)/?([\S]+) /proyecto.php?url_ver=$2
then entered to mypage.some/wp7/?http://www.google.com/

and show me 404 error :S and not redirection me :?

how can I do that?

Posted: Fri Nov 03, 2006 2:09 pm
by RobertGonzalez
This can be handled code-side, if that is what you are shooting for. Of course, you can use mod_rewrite, but the URL will not appear to change. To achieve the affect with code...

Code: Select all

<?php
if (isset($_GET['url']))
{
    $url = $_GET['url'];
    // validate the url here

    header('Location: http://' . $url);
    exit;
}
?>

Posted: Fri Nov 03, 2006 4:30 pm
by visonardo
thank, but your example is to use thus ?url=http://.......

but im saying thus ?http://......

i did something thus then in the script

Code: Select all

print_r($_GET);
but when take the get´s content change the dots by _ :? and if i passed http://www.google.com, it show me "http://www_google_com"

:?

Posted: Fri Nov 03, 2006 5:22 pm
by feyd
Look for $_SERVER['QUERY_STRING']

Posted: Fri Nov 03, 2006 9:31 pm
by visonardo
feyd wrote:Look for $_SERVER['QUERY_STRING']
thank feyd, is that i was searching :wink: