• [Mod] Search Engine Friendly URLs aka Short URLs 3 0 5 1
Currently:  

Author Topic: [Mod] Search Engine Friendly URLs aka Short URLs  (Read 756851 times)

0 Members and 2 Guests are viewing this topic.

Offline abdoh2010

  • Jr. Member
  • **
  • Posts: 96
    • View Profile
    • Racing 4 Education
Re: [Mod] Search Engine Friendly URLs aka Short URLs
« Reply #180 on: November 24, 2005, 08:42:41 PM »
i am not talking about that

i am talking about sessions.php changes

Offline abdoh2010

  • Jr. Member
  • **
  • Posts: 96
    • View Profile
    • Racing 4 Education
Re: [Mod] Search Engine Friendly URLs aka Short URLs
« Reply #181 on: November 26, 2005, 07:22:40 AM »
how to insert search.php?search_keywords in the url friendly ?

any one please ?

Offline Schaum

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: [Mod] Search Engine Friendly URLs aka Short URLs
« Reply #182 on: November 28, 2005, 12:16:46 PM »
Hello,
I have added this great mod, but I have a small understanding problem.
How know a search machine the other language sites?

To change the language, you must klick, on the Banner.
But I have like theses links:
Code: [Select]
categories.php?cat_id=39&page=&l=englishor the index:
Code: [Select]
?l=english
Normally the search engine is stopp “?” here.

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] Search Engine Friendly URLs aka Short URLs
« Reply #183 on: November 28, 2005, 03:01:19 PM »
This has been discused here, quiet recently. I see no point repeat the discussion again.
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 bibabobu

  • Sr. Member
  • ****
  • Posts: 311
  • Technische und künstlerische Gravuren
    • View Profile
    • Technische und künstlerische Gravuren für die gesamte Metall-, Kunststoff- und Papierindustrie
Re: [Mod] Search Engine Friendly URLs aka Short URLs
« Reply #184 on: November 30, 2005, 09:48:33 PM »
@ v@no
sorry, back to my (and txtaholics)  category dropdown selection menu problem.
It is still working on some pages and on some pages it will not work. I have not an idea where is the mistake.
I have repaired all IE errors i had on my site but it is still not working on every page onlyon some. (please try on my site)

Even one more question:
I have put this code to my .htaccess file
Code: [Select]
RewriteRule ^([a-zA-Z0-9_-]+)\.html$ index.php?template=$1&%{QUERY_STRING}for having this
www.industrie-gravuren.de/galerie/anfahrt.html
instead of this
www.industrie-gravuren.de/galerie/index.php?template=anfahrt
for example.
What i am doing wrong? It is not working for me.

Offline Maweryk

  • Sr. Member
  • ****
  • Posts: 253
    • View Profile
Re: [Mod] Search Engine Friendly URLs aka Short URLs
« Reply #185 on: November 30, 2005, 10:19:08 PM »
Hi,

mit dieser Regel klappt das auf jeden Fall bei mir und mit den Kategorien habe ich auch keine Probleme.
Wie sieht denn Dein ganzes .htaccess File aus und bei welchen Kategorien klappt es nicht?

Gruß

Markus

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] Search Engine Friendly URLs aka Short URLs
« Reply #186 on: December 01, 2005, 01:03:31 AM »
I dont think the problem is related to this mod. You have JavaScript errors on your site and since the dropdown menu is using javascript to auto jump to the sellected category it also producing error...The form with category select dropdown on "working" pages and "non working" are identical, but for unknown to me reason this JS error acure:
Quote
Error: forms.jumpbox has no properties
Lets do one step at a time: fix the javascript errors, then if the problem remains, we'll continue troubleshoot.

As of your custom template setup, the sign minus ( - ) must be escaped with a backslash:
Quote
RewriteRule ^([a-zA-Z0-9_\-]+)\.html$ index.php?template=$1&%{QUERY_STRING}
And make sure that this line is the last in .htaccess, otherwise every page you access would be treated as a custom template ;)
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 bibabobu

  • Sr. Member
  • ****
  • Posts: 311
  • Technische und künstlerische Gravuren
    • View Profile
    • Technische und künstlerische Gravuren für die gesamte Metall-, Kunststoff- und Papierindustrie
Re: [Mod] Search Engine Friendly URLs aka Short URLs
« Reply #187 on: December 01, 2005, 07:42:21 AM »
@ v@no
Thanks v@no.
Quote
Lets do one step at a time: fix the javascript errors, then if the problem remains, we'll continue troubleshoot.
How can find or see the javascript errors. I am using IE. In the status line there is no error to see.
Could you please help me to find. Thanks.

Offline Maweryk

  • Sr. Member
  • ****
  • Posts: 253
    • View Profile
Re: [Mod] Search Engine Friendly URLs aka Short URLs
« Reply #188 on: December 01, 2005, 07:48:11 AM »
@ v@no
Thanks v@no.
Quote
Lets do one step at a time: fix the javascript errors, then if the problem remains, we'll continue troubleshoot.
How can find or see the javascript errors. I am using IE. In the status line there is no error to see.
Could you please help me to find. Thanks.

Zeile:321
Zeichen:21
Code:0
Fehler:'{' erwartet
URL:http://www.industrie-gravuren.de/galerie/img206.htm

Zeile:621
Zeichen:21
Code:0
Fehler:'{' erwartet
URL:http://www.industrie-gravuren.de/galerie/cat9.htm

Zeile:690
Zeichen:21
Code:0
Fehler:'{' erwartet
URL:http://www.industrie-gravuren.de/galerie/

...

Gruß

Markus

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] Search Engine Friendly URLs aka Short URLs
« Reply #189 on: December 01, 2005, 08:13:04 AM »
Use Firefox - it has exelent JS debuging tool
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 bibabobu

  • Sr. Member
  • ****
  • Posts: 311
  • Technische und künstlerische Gravuren
    • View Profile
    • Technische und künstlerische Gravuren für die gesamte Metall-, Kunststoff- und Papierindustrie
Re: [Mod] Search Engine Friendly URLs aka Short URLs
« Reply #190 on: December 01, 2005, 10:01:23 PM »
 8O
 still not working on the end of my .htaccess file.
Code: [Select]
RewriteRule ^([a-zA-Z0-9_\-]+)\.html$ index.php?template=$1&%{QUERY_STRING}something is going wrong. i don't know why :?:

@ v@no thanks i will install firefox perhaps it is helping me to repair the javascripts.

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] Search Engine Friendly URLs aka Short URLs
« Reply #191 on: December 02, 2005, 12:23:18 AM »
Just tested myself - works just fine.


[EDIT]
are you sure thats the exact line from your .htaccess? cause link with .htm extension instead of .html works just fine:
http://www.industrie-gravuren.de/galerie/anfahrt.htm
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 bibabobu

  • Sr. Member
  • ****
  • Posts: 311
  • Technische und künstlerische Gravuren
    • View Profile
    • Technische und künstlerische Gravuren für die gesamte Metall-, Kunststoff- und Papierindustrie
Re: [Mod] Search Engine Friendly URLs aka Short URLs
« Reply #192 on: December 02, 2005, 11:19:27 PM »
hi v@no,

i found out my problem.
In my javascript for my site link menu there were the links in php style. I changed that into html links.
Now it is working fine :mrgreen:

Just one link in german language, the "kleinanzeiger" the rewrite does not work and i don't know why.
I changed it like i changed the other links. For surprise in the other languages this "kleinanzeiger" link also works great.  :roll:  :?:

EDIT:
I have installed Mozilla Firefox. And i already repaired some template problems.
Also i can find the Javascript problems. But i cannot fix them.
What a pity that i don't know how :?:
Perhaps you could help me to fix one error, so that i could repair the other errors on my own  :roll:

Offline lotus69

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: [Mod] Search Engine Friendly URLs aka Short URLs
« Reply #193 on: December 04, 2005, 03:29:01 PM »
Hi, for those who wants to have furl like this :
www.yourdomain.com/image-image,name,id.html
www.yourdomain.com/categorie-categorie,name,id,page.html
www.yourdomain.com/recherche-name,page.html
www.yourdomain.com/nouvelles-images,1,page.html

(you can see it on my web site : www.yatahonga.com)

first : in sessions.php
find the url function and replace it by :
Code: [Select]
function good_name($nom) {

$nom = str_replace(' ', ',', $nom);
$nom = str_replace('_', ',', $nom);
$nom = str_replace('--', ',', $nom);
$nom = str_replace('---', ',', $nom);
$nom = str_replace(',,', ',', $nom);
$nom = str_replace(',,,', ',', $nom);

$nom = str_replace('&', '', $nom);
$nom = str_replace('©', '', $nom);
$nom = str_replace('~', '', $nom);
$nom = str_replace('°', '', $nom);
$nom = str_replace('+', '', $nom);
$nom = str_replace('=', '', $nom);
   
$accent = "ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûýýþÿ";
$noaccent = "aaaaaaaceeeeiiiidnoooooouuuuybsaaaaaaaceeeeiiiidnoooooouuuyyby";
$nom = strtr(trim($nom),$accent,$noaccent);

return $nom;

}




  function url($url, $amp = "&", $nom = "" ) {
    global $l, $user_info;
       
    // on enleve les caracteres spéciaux du nom
   
$nom=$this->good_name($nom); 
   
 
    $dummy_array = explode("#", $url);
    $url = $dummy_array[0];
    $url = str_replace('&', '&', $url);
   
   
   
   
    if (!defined('IN_CP')) {
      if (strstr($url, 'index.php')) {
        $url = str_replace('index.php', '', $url);
      }
     
// POUR LA PAGE SEARCH.PHP     
      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', 'recherche-images,'.$matches[1].'.html', $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 if (strstr($url, 'search_new_images=')) {
          preg_match('#search_new_images=([0-9]+)&?#', $url, $matches);
          if (isset($matches[1])) {
            $split = explode('?', $url);
            $url = $split[0];
            $query = @$split[1];
            $url   = str_replace('search.php', 'nouvelles-images,'.$matches[1].'.html', $url);
          }
        } 
        else if (strstr($url, 'search_keywords=')) {
       
        //echo "<br>JE SUIS DS SEARCH KEYWORDS<br>";
       
          preg_match('#search_keywords=(.*)&?#', $url, $matches);
          if (isset($matches[1])) {
         
          //echo "<br>JE detecte les matchs : ".$matches[1]."<br>";
         
            $split = explode('?', $url);
            $url = $split[0];
            $query = @$split[1];
           
            //echo "<br>QUERY : ".$query[1]."<br>";
           
            $url   = str_replace('search.php', 'recherche-images,'.$matches[1].'.html', $url);
          }
        }       
        else {
          $url = str_replace('search.php', 'recherche-images.html', $url);
        }
      }

// POUR LA PAGE SEARCH_STATS.PHP     
 
      elseif (strstr($url, 'search_stats.php')) {
        $url = str_replace('search_stats.php', 'recherches-statistiques.html', $url);
      }     


// POUR LA PAGE CATEGORIE.PHP     
   
      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', 'categorie-'.$nom.','.$matches1[1].','.$matches2[1].'.html', $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];
            $url   = str_replace('categories.php', 'categorie-'.$nom.','.$matches[1].'.html', $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.html', $url);
        }
      }
     
// POUR LA PAGE DETAILS.PHP     
       
      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','image-'.$nom.','.$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','image-'.$nom.','.$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;
            }
          }
        }
      }
    }
    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;
  }

// *************************************************************
// FIN URL REWRITING
// *************************************************************

Note that if you want others statics words, you have to change the differents str_replace for search, details and categories

STEP 2 : in functions.php

wherevever you see :
$site_sess->url(ROOT_PATH."details.php?"
AND
$site_sess->url(ROOT_PATH."categories.php?"

just add the thir agurment wich is the cat or image name of course !
ex :

in function get_thumbnail_code(), for the condition if ($showlink), i set :
$thumb = "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id.((!empty($mode)) ? "&amp;mode=".$mode : ""),0,$image_name)."\" onclick=\"opendetailwindow()\" target=\"detailwindow\">".$thumb."</a>";

STEP 3 : paging.php

replace it by this :
Code: [Select]
<?php
/**************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *
 *             File: paging.php                                           *
 *        Copyright: (C) 2002 Jan Sorgalla                                *
 *            Email: jan@4homepages.de                                    *
 *              Web: http://www.4homepages.de                             *
 *    Scriptversion: 1.7                                                  *
 *                                                                        *
 *    Never released without support from: Nicky (http://www.nicky.net)   *
 *                                                                        *
 **************************************************************************
 *                                                                        *
 *    Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz-       *
 *    bedingungen (Lizenz.txt) für weitere Informationen.                 *
 *    ---------------------------------------------------------------     *
 *    This script is NOT freeware! Please read the Copyright Notice       *
 *    (Licence.txt) for further information.                              *
 *                                                                        *
 *************************************************************************/
if (!defined('ROOT_PATH')) {
  die(
"Security violation");
}

class 
Paging {
  var 
$page,$offset,$perpage,$num_rows_all,$link_args;
  var 
$first,$last,$total_pages,$config,$desc,$next,$back;

  function 
Paging($page 1$perpage 0$num_rows_all 0$link_args "") {
    global 
$lang$config;

    
$this->page $page;
    
$this->perpage $perpage;
    
$this->num_rows_all $num_rows_all;

    if (!isset(
$this->page) || !intval($this->page)) {
      
$this->page 1;
    }
    if (!
$this->num_rows_all) {
      
$this->total_pages 0;
    }
    elseif (
$this->num_rows_all <= $this->perpage) {
      
$this->total_pages 1;
    }
    elseif (
$this->num_rows_all $this->perpage == 0) {
      
$this->total_pages $this->num_rows_all $this->perpage;
    }
    else {
      
$this->total_pages ceil($this->num_rows_all $this->perpage);
    }
    if (
$this->page $this->total_pages) {
      
$this->page 1;
    }
    if (!
$this->num_rows_all) {
      
$this->first 0;
    }
    else {
      
$this->first $this->perpage $this->page $this->perpage 1;
    }
    if (!
$this->num_rows_all) {
      
$this->last 0;
    }
    elseif (
$this->page == $this->total_pages) {
      
$this->last $this->num_rows_all;
    }
    else {
      
$this->last $this->perpage $this->page;
    }

    
$this->offset $this->perpage $this->page $this->perpage;

    
$link_args ereg_replace("&page=[0-9]*"""$link_args);
    
$link_args ereg_replace("page=[0-9]*&"""$link_args);
    
$this->link_args basename($link_args);
    
$this->link_args .= preg_match("/\?/",$this->link_args) ? "&amp;" "?";

    
$this->desc $lang['paging_stats'];
    
$this->paging_next $lang['paging_next'];
    
$this->paging_back $lang['paging_previous'];
    
$this->paging_lastpage $lang['paging_lastpage'];
    
$this->paging_firstpage $lang['paging_firstpage'];
    
$this->range $config['paging_range'];
  }


// fct utile pour l'url rewriting
function good_page($url){

// on explode la chaine sur .
$url explode (".",$url);

//on ne renvoit que l'url sans le .html

return $url[0];
}




  function 
get_paging() {
    
$html "";
    if (
$this->total_pages 1) {
      
$page_back $this->page 1;
      
$page_next $this->page 1;

      if (
$page_back 0) {
        
$html .= "<a href=\"".$this->good_page($this->link_args).",1.html\" class=\"paging\">".$this->paging_firstpage."</a>&nbsp;&nbsp;";
        
$html .= "<a href=\"".$this->good_page($this->link_args).",$page_back.html\" class=\"paging\">".$this->paging_back."</a>&nbsp;&nbsp;";
      }
      for (
$page_num 1$page_num <= $this->total_pages$page_num++) {
        if (
$page_num >= ($this->page-$this->range) && $page_num <= ($this->page+$this->range)) {
          if (
$this->page == $page_num) {
            
$html .= "<b class=\"pagingon\">$page_num</b>&nbsp;&nbsp;";
          }
          else {
            
$html .= "<a href=\"".$this->good_page($this->link_args).",$page_num.html\" class=\"paging\">$page_num</a>&nbsp;&nbsp;";
          }
        }
      }
      if (
$page_next <= $this->total_pages) {
        
$html .= "<a href=\"".$this->good_page($this->link_args).",$page_next.html\" class=\"paging\">".$this->paging_next."</a>&nbsp;&nbsp;";
        
$html .= "<a href=\"".$this->good_page($this->link_args).",$this->total_pages.html\" class=\"paging\">".$this->paging_lastpage."</a>";
      }
    }
    return 
$html;
  }

  function 
get_offset() {
    return 
$this->offset;
  }

  function 
get_paging_stats() {
    global 
$site_template;
    
$search_array = array(
      
"/".$site_template->start."total_cat_images".$site_template->end."/iU",
      
"/".$site_template->start."total_pages".$site_template->end."/iU",
      
"/".$site_template->start."first_page".$site_template->end."/iU",
      
"/".$site_template->start."last_page".$site_template->end."/iU"
    
);
    
$replace_array = array(
      
$this->num_rows_all,
      
$this->total_pages,
      
$this->first,
      
$this->last
    
);
    
$this->desc preg_replace($search_array$replace_array$this->desc);
    return 
$this->desc;
  }
//end of class
?>


STEP 4 :  categories.php


in section SHOW IMAGE, juste replace

the $linkarg definition by :
$link_arg = $site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$cat_id,0,$cat_cache[$cat_id]['cat_name']);
( i just add the cat name ;) )


STEP 5 :  details.php


for next and prev image url, just add the name of the image like this :
Code: [Select]
$next_image_url = $site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$next_image_id.((!empty($mode)) ? "&amp;mode=".$mode : ""),0,$next_image_name);
Code: [Select]
$prev_image_url = $site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$prev_image_id.((!empty($mode)) ? "&amp;mode=".$mode : ""),0,$prev_image_name);

STEP 6 : search_form.html (template) and header.html (template too...)

for the form, add this : onsubmit="return form_url(this.search_keywords.value); "
(its a redirection function in order to get the name of the query

then add in your header this javascript function:
Code: [Select]
function form_url(keywords) {

// on remplace les espaces

ok_key = keywords.replace(/ /, ",");

location.href="http://www.YOURDOMAIN.com/recherche-images,"+ok_key+",1.html";
return false;
}
Note that if you change the statics words in STEP 1, you have to change it in this function

STEP 7 : change your htaccess...
here is mine :
Code: [Select]
RewriteEngine on



# REWRITE DES PAGES DETAILS

RewriteRule ^/image-(.*),([0-9]+)\.html$ /details.php?image_id=$2 [L]


# CATEGORIES

RewriteRule ^/categorie-(.*),([0-9]+),([0-9]+)\.html$ /categories.php?cat_id=$2&page=$3 [L]
RewriteRule ^/categorie-(.*),([0-9]+)\.html$ /categories.php?cat_id=$2 [L]



# SEARCH

RewriteRule ^/recherche-images\.html$ /search.php  [L]
RewriteRule ^/recherche-images,(.*),([0-9]+)\.html$ /search.php?show_result=1&search_keywords=$1&page=$2  [L]
RewriteRule ^/recherche-images,(.*)\.html$ /search.php?show_result=1&search_keywords=$1  [L]

RewriteRule ^recherches-statistiques\.html$ /search_stats.php  [L]
RewriteRule ^recherches-statistiques,([0-9]+)\.html$ /search_stats.php?page=$1  [L]



RewriteRule ^/nouvelles-images,1\.html$ /search.php?search_new_images=1  [L]
RewriteRule ^/nouvelles-images,1,([0-9]+)\.html$ /search.php?search_new_images=1&page=$1  [L]


And that's all ! (its quite easy, don't be afraid...)
the main function is function url in sessions.php, its here you have to pay attention for the name of your rewriting
and in all other page, you just have to add the name of categorie, image, search or whatever when you call the function url()
If you understand, you can do it for lighbox.php, member.php, postcard.php etc....

Best regards !
cyril

ps : i hope you understand how i code this and i apologize for my bad english

Offline waleed

  • Jr. Member
  • **
  • Posts: 71
    • View Profile
Re: [Mod] Search Engine Friendly URLs aka Short URLs
« Reply #194 on: December 06, 2005, 12:50:39 PM »
after i installed this MOD i got

Forbidden
You don't have permission to access / on this server.



am using 1.7.1

any idea plz ?