Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Masking outward links.

edited May 2006 in Vanilla 1.0 Help
How could I mask all outward links with a (hopefully) unique URL? Say if I had like one link to frank.com and one link to bob.com the links would become http://mysite.com?id=1 http://mysite.com?id=2 respectively. The URL format like that is not important, it just needs to be masked. Any ideas? And I should mention that this is for a static site (however the links will be updated), and not for a database driven or server side driven site.

Comments

  • http://tinyurl.com/ http://snipurl.com/ could probably help
  • not database driven or server-side? wait, what? you can do that?!

    are you just looking to have the links forward immediately to the "masked" site, like a redirect? or is there some other need to have them go through that middleman-referrer-page, like tracking (which could be difficult without some server-side code)?

    this is possible in javascript, but all you'd really be doing is passing a GET variable from the query string to a document.location redirection.
  • edited May 2006
    I think it *may* be possible using .htaccess. Anyone know? And I'm looking for something internal, not something like tinyurl. Thanks though.
  • like using mod_rewrite? now i really don't understand.
  • edited May 2006
    You could store them in a php file with a switch statement, please note that its been awhile so forgive the errors in syntax:
    <?php
    Header( "HTTP/1.1 301 Moved Permanently");
    switch ($id) {
    case 1:
       Header( "Location: http://bob.com" );
       break;
    case 2:
       Header( "Location: http://frank.com" );
       break;
    }  ?>
    There was a lot of talk about using 301 vs. 302, because of search engine hijacking, I believe 301 is the correct use for this case.

    EDIT: Oh--not server side... Try this: http://www.webweaver.nu/html-tips/web-redirection.shtml
  • K, is there an *easy* (javascript perhaps?) way to just have each link have a masked URL such as mysite.com/link_out/ that's not unique?
  • You could do this but it would be stored in the database in two different places, for example, each time you slot a link, it would have to hold the real link along with assigning it an alias, while useful if you want to keep all the links internal i don't see this as being helpful as the users then wouldn't know where they would be forwarded to and probably not click the link all together. I could easily slot goatse and tubgirl across your board then and you wouldn't know which is a good link or which is the imposter. I think in better practice, you could instead trim any links down to remove the preceeding http:// and then take out everything after the .com/org/co.uk/whatever and display it as such but keep the link in tact. Because then it would less confusing for your users.
  • Here's what the use is - http://www.sitepoint.com/forums/showthread.php?t=375304
  • Ahh, I interpretted this as a vanilla extension request. This seems a bit silly for that guy to want to mask his affiliates links as one of his own though, seems deceptive.
  • I usually see affiliate links masked by changing the statusbar javascript OnMouseOver to show different text than the link URL. http://www.google.com/search?q=mask+affiliate+link+javascript
  • edited May 2006
    Anyone know of a TinyURL type PHP Script? (can't believe I didn't think of a TinyURL clone before, sorry if that's what somebody posted here meant, and I misinterpreted) I've searched around and found just 1, but it's like 1.2MB which is about 1.19MB bigger than it needs to be.

    edit: just found Phurl, which seems pretty nice, but if you know of something better... :-)
  • most of them are around but you have to pay for it. I wrote up a small one that actually works but you'd have to customize it up some to prolly get it to how you would like it, and it requires database work - not a lot but some. its basically a .htaccess hack matched to 1 function which takes the affiliate id and switches it to latters and numbers. I'd have to look for it again but I believe I still have it, if you're up for taking a look at it, and making the database for it I'd share it.
  • edited May 2006
    I'd be interested in seeing if you still have it Trey :). Wewt, just found another that's only 3.5 kilobytes, now that's how big it should be. It's http://www.kinkydress.com/php-scripts/short-url/ It's definately the best yet. EDIT: OMFG, I'm in love with this software, it even requires a password, just like I needed it to. c-unit <3s ShortURL.
  • TreyTrey New
    edited May 2006
    that script is easy to create :-p the one I have uses letters and numbers, - not only numbers. and theres no question marks in the url because of the .htaccess file. keep in mind thats its not done completely, its just a rough outline so you're gonna need to know php to get it working correctly. I just wanted to proove to myself that I could create something like tiny url has ;)

    heres the script
  • Thanks! Unfortunately my PHP skills are near nill. And I guess letters and numbers are good for sites like TinyURL, but I think in an affiliate setting just numbers are better because they're more "hackable" for the user.
This discussion has been closed.