Jump to content

Redirect Imagini Din Google Images Catre Home Page


Recommended Posts

Posted

Poate multi dintre voi v-ati intrebat cum sa faceti ca imaginile afisate in google images, in momentul in care sunte accesate de catre un utilizator, acesta sa fie redirectionat catre home page, si nu sa se deschida in fereastra imaginea, cum se intampla de obicei.

Daca va ganditi sa il blocati pe google sa mai indexeze imaginile, nu este o ideea prea inteleapta, pentru ca si imaginile sunt o sursa de trafic.

Ce va trebui sa faceti in acest caz ?

1. In fisierul index.php din site-ul dumneavoastra, inainte de sfarsitul tag-ului head puneti urmatoarea linie:

<script language="javascript" src="http://www.site.ro/refresh.js"></script>
</head>[/code] [color=red][b]2.[/b][/color] Creati apoi un fisier [b][color=green]refresh.js[/color][/b] pe care il copiati pe host, si care va trebui sa contina urmatoarea linie:
[code]if (window != top) top.location = self.location;
Sau, mai exista si o alta metoda, si anume, prin folosirea unui plugin pentru wordpress:
<?php 
/*
Plugin Name: Break Out Of Frames
Plugin URI: [url]http://www.g-loaded.eu/2006/01/05/break-out-of-frames-wordpress-plugin/[/url]
Description: Avoid being framed by some other web site.
Version: 0.3
Author: GNot
Author URI: [url]http://www.g-loaded.eu/[/url]
*/

/*
License: GPL
Compatibility: All

Installation:
Place the break-out-of-frames.php file in your /wp-content/plugins/ directory
and activate through the administration panel.

Special Info:
This plugin does not use the is_preview() function at the moment due to some issues.
*/

/*  Copyright George Notaras ([url]http://www.g-loaded.eu/[/url])

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/


/* Changelog
* Fri Jan 26 2007 - v0.3
- The is_preview() WP function works ok now, so it is used in the plugin.
- Updated plugin homepage URL.
* Wed Nov 1 2006 - v0.2
- Plugin info update
* Thu Jan 5 2006 - v0.1
- Initial release
*/


function break_out_of_frames()
{
//    if ( !isset($_SERVER['HTTP_REFERER']) || $_SERVER['REQUEST_URI'] == '/' || substr($_SERVER['HTTP_REFERER'], strlen(get_bloginfo('url')), 36) != '/wp-admin/post.php?action=edit&post=' ) {
   if (!is_preview() ) {
       echo "\n<script type=\"text/javascript\">";
       echo "\n<!--";
       echo "\nif (parent.frames.length > 0) { parent.location.href = location.href; }";
       echo "\n-->";
       echo "\n</script>\n\n";
   }
}

add_action('wp_head', 'break_out_of_frames');

?> [/code]

Te-ai inregistrat? Ne-ar placea sa te prezinti.

Cum pot sustine forumul?
Cumpara de la eMag folosind acest link.
--------------------
oG2BN9d.gifse1WdXd.gifQG6MtmI.gifRHYjDzD.gifG5p1wui.gif

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.