Redirect question...

PapiShasho

New member
Jun 15, 2009
15
0
0
How can I make all URLs on page automatically be redirected through a script? I've been searching everywhere and it seems so common yet I can't find what I need. It works the way this site does it, where every outbound link automatically goes through the redirect.php script. I know how to manually do this with a link, but not have every outbound link automatically be redirected.

PopUrls also does this but in a /go/ folder, and I've seen some Wordpress blogs do this.
 


Yeah I assume I'd use php considering the redirect file is named redirect.php and I've done php redirects before manually, but never automatically. Is this somethind I add to the .htaccess file?

The closest I found was this thread, http://www.wickedfire.com/design-development-programming/68795-script-redirect.html , but I don't know how to decipher jQuery.

Put it this way. I have a site called ICDMeister Online - Fast and Easy ICD-9 Code Lookup - Designed for Doctors not for Coders, and it's some type of directory or blog or whatever, and I'd want every outbound link that gets posted to get redirected through ICDMeister Online - Fast and Easy ICD-9 Code Lookup - Designed for Doctors not for Coders.

PHP would handle the redirects but I assume the converting of every link is handled through .htaccess?

EDIT: [noscript]http://www.randomurl.com to http://www.mysite.com/bye/randomurl.com[/noscript] = automatically for every outbound link generated. How?

EDIT: die vbulletin
 
First of all wtf are you talking about? just explain what the original link looks like, and what the new destination link looks like - it makes a difference for the kind of answers you will get. If it's a translation type of thing, where every link can be easily converted to the new link, based on the structure of the old link, then yeah you can use htaccess and it might be the best way to go. But damn if i can tell what you really want to do.
 
Yeah I tried that with my edits but they kept getting converted to real links.

Ok if I have a blog that just pulls feeds, and instead of the links going directly to the news source or whatever, I want them to go through mysite.com/bye/http://www.newslink.com/whatevefrljkcfbl, is that possible?

In other words, go to popurls.com and look at their links.
 
You will need to edit your htaccess file so it's rewriting your urls. Example: (it's old so the amazon urls aren't right any longer I don't think).

RewriteCond %{QUERY_STRING} id=([^&]*)$
RewriteRule ^products\.php$ http://www.amazon.com/exec/obidos/ASIN/%1/YOURAMAZONID? [L]

Basically what the above code does is converts mydomain.com/products.php?id=AMAZON-PRODUCT-ID even without the existence of products.php file on your [COLOR=#FF9933 ! important][COLOR=#FF9933 ! important]webserver[/COLOR][/COLOR], it’ll be redirected automatically to the Amazon link using your Referal ID


Obviously the url strucuture you are dealing with is different than amazon's so if you really want some help you gotta give up some info.
 
That was a little confusing but it gives me the right idea so I know what to research now. Thanks!
 
Have a look for the dfhu.org blog. Has a good tutorial on htaccess and mod_rewrite.
 
If your webserver is setup correctly then you could take advantage of the $_SERVER['PATH_INFO'] environment variable.

for example:

index.php/http://www.wickedfire.com/some/folder/page.php would yield:
/http:/www.wickedfire.com/some/folder/page.php

whack off a slash and you got the destination url from the full url itself. Course that method only works when the file name (ie: index.php) , is present in the url, otherwise you'll need to use mod_rewrite above to parse the url.

I've always been in favor of masked urls as they don't seem quite as 'affiliatey' to average joes. Kinda like some of my banners on kbeezie.com goto hxxp://links.kbeezie.com/knownhost/ and I just have kblinker handle the redirect.