pass an complete url then the ? simbol using mod_rewrite

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
User avatar
visonardo
Forum Contributor
Posts: 136
Joined: Mon Oct 02, 2006 7:49 pm
Location: Argentina, South America´s Sun.

pass an complete url then the ? simbol using mod_rewrite

Post 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?
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post 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;
}
?>
User avatar
visonardo
Forum Contributor
Posts: 136
Joined: Mon Oct 02, 2006 7:49 pm
Location: Argentina, South America´s Sun.

Post 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"

:?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Look for $_SERVER['QUERY_STRING']
User avatar
visonardo
Forum Contributor
Posts: 136
Joined: Mon Oct 02, 2006 7:49 pm
Location: Argentina, South America´s Sun.

Post by visonardo »

feyd wrote:Look for $_SERVER['QUERY_STRING']
thank feyd, is that i was searching :wink:
Post Reply