• [MOD] Google Friendly Urls For 4images Best Seo Mod 4 0 5 1
Currently:  

Author Topic: [MOD] Google Friendly Urls For 4images Best Seo Mod  (Read 707245 times)

0 Members and 1 Guest are viewing this topic.

Offline yousaf

  • Jr. Member
  • **
  • Posts: 59
    • View Profile
Re: [MOD] Google Friendly Urls For 4images Best Seo Mod
« Reply #420 on: June 03, 2011, 11:01:21 PM »
@ V@no,

i used your optimized code for session.php and im extremely glad that with that help i reduced my server load to half. now i want to modify the permalink structure in .htaccess, i changed the structure on a demo site and it worked but i need help in one thing n that is Redirection of old permalink structure to the new one

right now i have this structure in .htaccess

RewriteRule ^img-(.*)-([0-9]+)\.htm$ details.php?image_id=$2&%{QUERY_STRING}

so when i change it to

RewriteRule ^Wallpaper-(.*)-([0-9]+)\.html$ details.php?image_id=$2&%{QUERY_STRING}

how do i redirect the old one to the new structure for Search engine bots and backlinks ? so if someone come from google's search result they go through the new structure instead of a finding a 404 error

regards
Yousaf

Offline sunl

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: [MOD] Google Friendly Urls For 4images Best Seo Mod
« Reply #421 on: June 27, 2011, 03:35:57 AM »
Hello All Fellow Members

I have problem with related to this mode. You see i try facebook comment box to put in site but i am not able to figure out to get current page. Please help.

Code: [Select]
<div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:comments href="http://example.com" num_posts="2" width="500"></fb:comments>
What is the replacement code for (http://example.com) so i can get current page not main domain


Thanks

Offline Szooguun

  • Newbie
  • *
  • Posts: 47
    • View Profile
Re: [MOD] Google Friendly Urls For 4images Best Seo Mod
« Reply #422 on: June 30, 2011, 04:02:15 PM »
I made this modification, but after a while I went back to standard. Google zaindeksowało new url. Now the question. How to do a 301 redirect to the standard URL:


cat.***.htm
on
categories.php?cat_id=

and

img.***.htm
on
details.php?image_id=

and

postcard.img***.htm
on
postcards.php?image_id=


Sorry for my English. Please help.

Offline yousaf

  • Jr. Member
  • **
  • Posts: 59
    • View Profile
Re: [MOD] Google Friendly Urls For 4images Best Seo Mod
« Reply #423 on: July 03, 2011, 10:56:05 PM »
No Response coming from anywhere :( not even from author nor Mods
is everyone on Vacations?

Offline sathishIPL

  • Jr. Member
  • **
  • Posts: 54
    • View Profile
Re: [MOD] Google Friendly Urls For 4images Best Seo Mod
« Reply #424 on: July 22, 2011, 11:45:50 AM »
@ V@no,

i used your optimized code for session.php and im extremely glad that with that help i reduced my server load to half. now i want to modify the permalink structure in .htaccess, i changed the structure on a demo site and it worked but i need help in one thing n that is Redirection of old permalink structure to the new one

right now i have this structure in .htaccess

RewriteRule ^img-(.*)-([0-9]+)\.htm$ details.php?image_id=$2&%{QUERY_STRING}

so when i change it to

RewriteRule ^Wallpaper-(.*)-([0-9]+)\.html$ details.php?image_id=$2&%{QUERY_STRING}


how do i redirect the old one to the new structure for Search engine bots and backlinks ? so if someone come from google's search result they go through the new structure instead of a finding a 404 error

regards
Yousaf

open /include/sessions.php and replace the below code with the old one.  


I didnt test the code and i hope it will work for you

/* ORIGINAL CODE
  function url($url, $amp = "&amp;") {
    global $l;
    $dummy_array = explode("#", $url);
    $url = $dummy_array[0];

    if ($this->mode == "get" && !preg_match("/".SESSION_NAME."=/i", $url)) {
      $url .= preg_match("/\?/", $url) ? "$amp" : "?";
      $url .= SESSION_NAME."=".$this->session_id;
    }

    if (!empty($l)) {
      $url .= preg_match("/\?/", $url) ? "$amp" : "?";
      $url .= "l=".$l;
    }

    $url .= (isset($dummy_array[1])) ? "#".$dummy_array[1] : "";
    return $url;
  }
*/
  
function url($url$amp "&amp;") {
    global 
$l$user_info;
    
$dummy_array explode("#"$url);
    
$url $dummy_array[0];
    
$url str_replace('&amp;''&'$url);
    if (!
defined('IN_CP')) {
      if (
strstr($url'index.php')) {
        
$url str_replace('index.php'''$url);
      }
      elseif (
strstr($url'search.php')) {
        if (
strstr($url'page=')) {
          
preg_match('#page=([0-9]+)&?#'$url$matches);
          if (isset(
$matches[1])) {
            
$split explode('?'$url);
            
$url $split[0];
            
$query = @$split[1];
            
$url   str_replace('search.php''search.'.$matches[1].'.htm'$url);
            
$query str_replace('page='.$matches[1].'&'''$query);
            
$query str_replace('&page='.$matches[1], ''$query);
            
$query str_replace('page='.$matches[1], ''$query);
            if (!empty(
$query)) {
              
$url .= '?' $query;
            }
          }
        }
        else {
          
$url str_replace('search.php''search.htm'$url);
        }
      }
      elseif (
strstr($url'lightbox.php')) {
        if (
strstr($url'page=')) {
          
preg_match('#page=([0-9]+)&?#'$url$matches);
          if (isset(
$matches[1])) {
            
$split explode('?'$url);
            
$url $split[0];
            
$query = @$split[1];
            
$url   str_replace('lightbox.php''lightbox.'.$matches[1].'.htm'$url);
            
$query str_replace('page='.$matches[1].'&'''$query);
            
$query str_replace('&page='.$matches[1], ''$query);
            
$query str_replace('page='.$matches[1], ''$query);
            if (!empty(
$query)) {
                
$url .= '?' $query;
            }
          }
        }
        else {
          
$url str_replace('lightbox.php''lightbox.htm'$url);
        }
      }
      elseif (
strstr($url'categories.php')) {
        if (
strstr($url'cat_id=') && strstr($url'page=')) {
          
preg_match('#cat_id=([0-9]+)&?#'$url$matches1);
          
preg_match('#page=([0-9]+)&?#'$url$matches2);
          if (isset(
$matches1[1]) && isset($matches2[1])) {
            
$split explode('?'$url);
            
$url $split[0];
            
$query = @$split[1];
            
$url   str_replace('categories.php''cat'.$matches1[1].'.'.$matches2[1].'.htm'$url);
            
$query str_replace('cat_id='.$matches1[1].'&'''$query);
            
$query str_replace('&cat_id='.$matches1[1], ''$query);
            
$query str_replace('cat_id='.$matches1[1], ''$query);
            
$query str_replace('page='.$matches2[1].'&'''$query);
            
$query str_replace('&page='.$matches2[1], ''$query);
            
$query str_replace('page='.$matches2[1], ''$query);
            if (!empty(
$query)) {
              
$url .= '?' $query;
            }
          }
        }
        elseif (
strstr($url'cat_id=')) {
          
preg_match('#cat_id=([0-9]+)&?#'$url$matches);
          if (isset(
$matches[1])) {
            
$split explode('?'$url);
            
$url $split[0];
            
$query = @$split[1];
            
$cat_url get_category_url($matches[1]);
            
$url   str_replace('categories.php''cat'.$cat_url.'.htm'$url);
            
$query str_replace('cat_id='.$matches[1].'&'''$query);
            
$query str_replace('&cat_id='.$matches[1], ''$query);
            
$query str_replace('cat_id='.$matches[1], ''$query);
            if (!empty(
$query)) {
              
$url .= '?' $query;
            }
          }
        }
        else {
          
$url str_replace('categories.php''cat.htm'$url);
        }
      }
      elseif (
strstr($url'details.php?image_id=')) {
        if (
strstr($url'image_id=') && strstr($url'mode=')) {
          
preg_match('#image_id=([0-9]+)&?#'$url$matches1);
          
preg_match('#mode=([a-zA-Z0-9]+)&?#'$url$matches2);
          if (isset(
$matches1[1]) && isset($matches2[1])) {
            
$split explode('?'$url);
            
$url $split[0];
            
$query = @$split[1];
            
$url   str_replace('details.php''wallpaper'.$matches1[1].'.'.$matches2[1].'.html'$url);
            
$query str_replace('image_id='.$matches1[1].'&'''$query);
            
$query str_replace('&image_id='.$matches1[1], ''$query);
            
$query str_replace('image_id='.$matches1[1], ''$query);
            
$query str_replace('mode='.$matches2[1].'&'''$query);
            
$query str_replace('&mode='.$matches2[1], ''$query);
            
$query str_replace('mode='.$matches2[1], ''$query);
            if (!empty(
$query)) {
              
$url .= '?' $query;
            }
          }
        }
        else {
          
preg_match('#image_id=([0-9]+)&?#'$url$matches);
          if (isset(
$matches[1])) {
            
$split explode('?'$url);
            
$url $split[0];
            
$query = @$split[1];
            
$url   str_replace('details.php''Wallpaper'.get_image_url($matches[1]).'.html'$url);
            
$query str_replace('image_id='.$matches[1].'&'''$query);
            
$query str_replace('&image_id='.$matches[1], ''$query);
            
$query str_replace('image_id='.$matches[1], ''$query);
            if (!empty(
$query)) {
              
$url .= '?' $query;
            }
          }
        }
      }
      elseif (
strstr($url'postcards.php?image_id=')) {
        
preg_match('#image_id=([0-9]+)&?#'$url$matches);
        if (isset(
$matches[1])) {
          
$split explode('?'$url);
          
$url $split[0];
          
$query = @$split[1];
          
$url   str_replace('postcards.php''postcard.img'.$matches[1].'.htm'$url);
          
$query str_replace('image_id='.$matches[1].'&'''$query);
          
$query str_replace('&image_id='.$matches[1], ''$query);
          
$query str_replace('image_id='.$matches[1], ''$query);
          if (!empty(
$query)) {
            
$url .= '?' $query;
          }
        }
      }
    }
    if (
$this->mode == "get" && strstr($url$this->session_id)) {
      
$url .= strpos($url'?') !== false '&' '?';
      
$url .= SESSION_NAME."=".$this->session_id;
    }
    if (!empty(
$l)) {
      
$url .= strpos($url'?') ? '&' '?';
      
$url .= "l=".$l;
    }
    
$url str_replace('&'$amp$url);
    
$url .= isset($dummy_array[1]) ? "#".$dummy_array[1] : "";
    return 
$url;
  }




« Last Edit: July 22, 2011, 11:56:32 AM by sathishIPL »

Offline yousaf

  • Jr. Member
  • **
  • Posts: 59
    • View Profile
Re: [MOD] Google Friendly Urls For 4images Best Seo Mod
« Reply #425 on: July 22, 2011, 12:33:43 PM »
Sathish Thank you, i have done this already in Sessions.php but i need to redirect my indexed links to the new Permalink structure. so if someone is following the old link structure from search engines may ends up in the new one.

Offline sathishIPL

  • Jr. Member
  • **
  • Posts: 54
    • View Profile
Re: [MOD] Google Friendly Urls For 4images Best Seo Mod
« Reply #426 on: July 22, 2011, 09:18:17 PM »
Sathish Thank you, i have done this already in Sessions.php but i need to redirect my indexed links to the new Permalink structure. so if someone is following the old link structure from search engines may ends up in the new one.

hi redirect to permalink structure is possible but there is loads of manual work we have to do.for each dynamic link have redirect.

Google and other major search engines has introduced canonical tag to overcome the duplicate links.

i have done little modification for details page alone  and i hope it will help you.

i am a newbie to 4images and novice to PHP[i am just learning here]

copy the below code into session.php  before ?>


if($image_id>0)
{
$site_template->register_vars(array(
      
"has_imageid"   => true,
      
"domain" =>"<link rel=\"canonical\"  href=\"".$script_url."/wallpaper".get_image_url($image_id).".htm\">"
        
));
}



goto templates/yourtemplates/header.html and paste the below code between <head> </head>
{if has_imageid}
{
domain}
{endif 
has_imageid}



Above changes will give you a URL Like <link rel="canonical" href= "http://www.yourdomain.com/wallpaper-someting-1.html">
« Last Edit: July 27, 2011, 12:52:47 PM by sathishIPL »

Offline rsmler

  • Pre-Newbie
  • Posts: 2
    • View Profile
Re: [MOD] Google Friendly Urls For 4images Best Seo Mod
« Reply #427 on: July 23, 2011, 01:19:25 AM »
in the final version of this add-on brings the problem. can not log in admin panel. how do I solve this problem?

Offline jeyjoo

  • Newbie
  • *
  • Posts: 46
  • Jeyjoo Web Design
    • View Profile
    • Sheffield Web Design
Re: [MOD] Google Friendly Urls For 4images Best Seo Mod
« Reply #428 on: August 09, 2011, 11:29:39 AM »
@Veno
I have this working now, so thanks for that.
I came across a problem where by the image names in URL are not correct (where a capital letter was used. It had something to do with the function below:

Quote
$row['image_name'] = strtr($row['image_name'], "éèêàëâúóíáABCDEFGHIJKLMNOPQRSTUVWXYZ","eeeaeauoiaabcdefghijklmnopqrstuvwxyz");

For example in this URL http://www.jeyjoo.com/gallery/img-prench-fisherman-487.htm, the Capital "F" for France is actually replaced by a "p".

Anyway, now idea why, but I changed the order as below, and all is ok now:

Quote
$row['image_name'] = strtr($row['image_name'], "ABCDEFGHIJKLMNOPQRSTUVWXYZéèêàëâúóíá","abcdefghijklmnopqrstuvwxyzeeeaeauoia");



« Last Edit: August 09, 2011, 11:57:33 AM by jeyjoo »
Jeyjoo - kick ass web design, SEO and online marketing packages.

http://www.jeyjoo.com/gallery/ - free stock images (a 4images gallery)  |
http://www.jeyjoo.com - Sheffield web design  |  http://www.jeyjoo.com - Sheffield SEO  |  http://it.jeyjoo.com - Web Design Milano  |  http://it.jeyjoo.com - SEO Italiano

Offline jeyjoo

  • Newbie
  • *
  • Posts: 46
  • Jeyjoo Web Design
    • View Profile
    • Sheffield Web Design
Re: [MOD] Google Friendly Urls For 4images Best Seo Mod
« Reply #429 on: September 02, 2011, 11:02:48 PM »
I have implemented this mod. What I would like is to add a canonical URL to my images for SEO purposes.

That I know of, each image in my gallery has 2 URLs depending on whether it came through search results or not. For example, the following URLs refer to the same image:

http://www.jeyjoo.com/gallery/img254.search.htm
http://www.jeyjoo.com/gallery/img-green-spider-on-red-strawberry-254.htm

To counter this I want to add a canonical URL in the head section of both pages, so esearch engines understand that it is effectively just 1 page:

<link rel="canonical" href="http://www.jeyjoo.com/gallery/img-green-spider-on-red-strawberry-254.htm" />

The canonical link is supported by Google, and tells a search engine which of the mutliple URLs to give importance to (link juice).

Much appreciated
Jeyjoo - kick ass web design, SEO and online marketing packages.

http://www.jeyjoo.com/gallery/ - free stock images (a 4images gallery)  |
http://www.jeyjoo.com - Sheffield web design  |  http://www.jeyjoo.com - Sheffield SEO  |  http://it.jeyjoo.com - Web Design Milano  |  http://it.jeyjoo.com - SEO Italiano

Offline jeyjoo

  • Newbie
  • *
  • Posts: 46
  • Jeyjoo Web Design
    • View Profile
    • Sheffield Web Design
Re: [MOD] Google Friendly Urls For 4images Best Seo Mod
« Reply #430 on: October 09, 2011, 04:18:52 PM »
Sathish Thank you, i have done this already in Sessions.php but i need to redirect my indexed links to the new Permalink structure. so if someone is following the old link structure from search engines may ends up in the new one.

hi redirect to permalink structure is possible but there is loads of manual work we have to do.for each dynamic link have redirect.

Google and other major search engines has introduced canonical tag to overcome the duplicate links.

i have done little modification for details page alone  and i hope it will help you.

i am a newbie to 4images and novice to PHP[i am just learning here]

copy the below code into session.php  before ?>


if($image_id>0)
{
$site_template->register_vars(array(
      
"has_imageid"   => true,
      
"domain" =>"<link rel=\"canonical\"  href=\"".$script_url."/wallpaper".get_image_url($image_id).".htm\">"
        
));
}



goto templates/yourtemplates/header.html and paste the below code between <head> </head>
{if has_imageid}
{
domain}
{endif 
has_imageid}



Above changes will give you a URL Like <link rel="canonical" href= "http://www.yourdomain.com/wallpaper-someting-1.html">

Perfect. Thats exactly what I was looking for.
Thanks
Jeyjoo - kick ass web design, SEO and online marketing packages.

http://www.jeyjoo.com/gallery/ - free stock images (a 4images gallery)  |
http://www.jeyjoo.com - Sheffield web design  |  http://www.jeyjoo.com - Sheffield SEO  |  http://it.jeyjoo.com - Web Design Milano  |  http://it.jeyjoo.com - SEO Italiano

Offline alekseyn1

  • Full Member
  • ***
  • Posts: 102
    • View Profile
    • My Project
Re: [MOD] Google Friendly Urls For 4images Best Seo Mod
« Reply #431 on: October 20, 2011, 11:18:06 AM »
i am soory if I missed the solution to this problem, but it's been bothering me for a while...

I have a bridge installed 4images<->phpBB3 and after login and logout, phpBB redirects me to the page where I have been when I clicked the submit button on the login form... I am positive that phpBB redirects correctly.

I then have a script that logs the user in/out:


//
	
login/logout 4images user on phpBB session data
	
if(
$bbuser->data['user_id'] != ANONYMOUS && ($user_info['user_id'] == -|| $user_info['user_name'] != $bbuser->data['username'])){

	
$user_exists $site_sess->login($bbuser->data['username'], $bbuser->data['user_password'], 01false);

    if (
$referer $_SERVER['HTTP_REFERER']) {  //this was an attempt to fix my problem from this tipic - http://www.4homepages.de/forum/index.php?topic=22887.0
    
redirect($referer); 
	
}
  
    
// if (!ereg("index.php", $url) && !ereg("login.php", $url) && !ereg("register.php", $url) && !ereg("member.php", $url)) {
      // redirect($url);
    // }
     
else {
       
redirect("index.php");
    }

	
}


I am still unable to make it work correctly.... I am being redirected to the index.php all the time no matter what I do... any ideas will be much appreciated...
v@no suggested here that I'd post here since my issue could be related to this MOD...

Offline khansahib

  • Full Member
  • ***
  • Posts: 100
    • View Profile
Re: [MOD] Google Friendly Urls For 4images Best Seo Mod
« Reply #432 on: November 15, 2011, 10:24:53 PM »
i'm trying to add the optimized code of vano but i'm getting this..

Cannot redeclare fixname()

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] Google Friendly Urls For 4images Best Seo Mod
« Reply #433 on: November 16, 2011, 05:23:22 AM »
just remove the fixname function from my code (make sure you match { and } brackets)
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline khansahib

  • Full Member
  • ***
  • Posts: 100
    • View Profile
Re: [MOD] Google Friendly Urls For 4images Best Seo Mod
« Reply #434 on: November 16, 2011, 03:36:05 PM »
now,

Fatal error: Cannot redeclare get_category_url()