Table of Contents

Direct Out Links

Note: This information is outdated as of 2011.12, but retained for reference.

Google has deoptimized many sites previously hosted on SmartThumbs. While we don't know exactly what triggered this, it's possible similar issues could affect trade sites using out.php without direct links.

If you're concerned that Google may penalize sites with out.php redirects, here are some alternative approaches:

Options:

Option 1: jQuery + jsvar

This approach adds out.php redirects via JavaScript. For users with JavaScript enabled, the links function the same as before. For users without JS, all traffic goes to content (100%).

Add this code to your page:

<script src='/scj/includes/js/jquery.js'></script>
<script>
	$(document).ready(function(){
		$('a[jsvar=out]').each(function(){
				var href = '/out.php?url=' + $(this).attr('href') + '&link=' + $(this).attr('link');
				$(this).attr('href', href);
		});
	});
</script>

For links that should redirect through out.php, add the `jsvar='out'` attribute:

<a jsvar='out' href='http://gallery.com/'> out link </a> <br>

For direct links without out.php:

<a href='http://gallery.com/'> direct link </a>

That's all. Both links appear “direct” to Google's crawler (at least for now).

Here's a complete HTML example for testing. Save it as test.html in your SmartCJ domain root:

<html>
<body>
<script src='/scj/includes/js/jquery.js'></script>
<script>
	$(document).ready(function(){
		$('a[jsvar=out]').each(function(){
				var href = '/out.php?url=' + $(this).attr('href');
				$(this).attr('href', href);
		});
	});
</script>

<a jsvar='out' href='http://gallery.com/'> out link </a> <br>
<a href='http://gallery.com/'> direct link </a>

</body>
</html>

Option 1 with Stream

Write a sub-template in Stream:

<a jsvar='out' pos=#POS# href="#ENCODED_GAL#"><img src="#THUMB#" width="140" height="180" alt="#DESC#" class="tumb"></a>

Add the JavaScript code to the main template (before the closing `</body>` tag):

<script src='/scj/includes/js/jquery.js'></script>
<script>
	$(document).ready(function(){
		$('a[jsvar=out]').each(function(){
				var href = 'streamrotator/out.php?l='+$(this).attr('pos')+'&u=/scj/cgi/out.php?url=' + $(this).attr('href');
				$(this).attr('href', href);
		});
	});
</script>

This option is similar to Option 1, but JavaScript directly manages skimming, and only trading clicks are sent to the trade script. This effectively replaces the script's built-in skimming.

For users with JavaScript enabled, all traffic goes to content (100%). In your script settings, set skimming to 0% so the script only counts trade clicks (though URL clicks are still tracked).

<script src='/scj/includes/js/jquery.js'></script>
<script>
<script>
	var first_click = true; // or false if you dont want first click
	var skimming = 60; // <-- this is SKIMMING

	var current_click = 0; // that's for me

	$(document).ready(function(){

	$('a[jsvar=out]').click(function(e) {
		current_click++;

        if (first_click && current_click == 1) {
			url_click($(this).attr('href'));
        	return true;
        }

        alert(current_click);

        if(Math.random()*100 <= skimming) {
			url_click($(this).attr('href'));
        	return true;
        } else {
        	$(this).attr('href', '/scj/cgi/out.php?'+escape($(this).attr('params')));
        }

		return true;
	});

	function url_click(url) {
		$.get('/scj/cgi/out.php?p=100&url=' + url,
			{
			},
  			function(data) {
	  		}
		);
	}
});
</script>

Use the same link format as Option 1.

Option 3: mod_rewrite

This approach replaces out.php with a different URL (like gallery.html), while the server actually executes out.php behind the scenes.

The example below uses Stream, but you can apply the same technique with the built-in rotator or any other system.

1. Place an .htaccess file where out.php is located:

RewriteEngine on
RewriteRule ^gallery/(.*)$ streamrotator/out.php?%{QUERY_STRING}

2. Replace old links:

<a href='out.php?url=http://gallery.com/'>thumb</a>

With the rewritten format:

<a href='/gallery/somegallery.html?url=http://gallery.com/'>thumb</a>

For Stream, use this sub-template format:

<a href=“/gallery/#DESC#.html?l=#POS#&u=/scj/cgi/out.php?url=#ENCODED_GAL#”><img src=“#THUMB#” width=“180” height=“240” alt=“#DESC#” class=“IMG”></a>

Option for trader top lists

Add this rule to .htaccess:

RewriteRule ^partner/(.+)/(.+).html$ /scj/cgi/out.php?link=$1&member=$2 [L,QSA]

Then use URLs in your top list like:

href="/partner/mtop/_MEMBER_1_.html"