使用 PHP 屏蔽 URL


Masking URLs With PHP

有没有办法用PHP或其他东西屏蔽URL?我想将自定义域与 goo.gl 一起使用,基本上我希望能够将某人发送到 http://l.bearce.me/iS7tz 并让他们重新创建以自动 http://goo.gl/iS7tz。

发誓我以前见过这样的东西,但我不记得它的名字了。

你是说这个?(URL伪装,带有onclick事件的纯HTML)

<a href="http://google.com" onclick="window.location='http://yahoo.com';return false;">Google</a>

还是这个?(HTTP 重定向)

<?php
// get $path form the url (I suppose you're using mod_rewrite or similar)
$path =  $_GET['some_url_var'];
header("location: http://goo.gl/$path"); // redirect
?>