+ -

Menu

Forum

Sujets Importants

Espace membre

Forum : Masquer l’entête

Accès rapide :

 

Effectuer une Recherche avancée OU


Duplicate content avec url_rewriting  [2 réponses]

¥Gothicae
Modérateur
starsv5.png
Ultra Méchant


avatar
Hors ligne

Nombre de posts: 1539 (0.68/Jour)
Inscrit(e) le: 13 avril 2007

Niveau en PHP : Intermédiaire
Imprimer Permalien mardi 27 septembre 2011 à 10:00  

Bonjour,

Je me trouve confronté à un gros problème, j'utilise depuis quelques années l'url rewrting, et je me suis rendu compte il y a peu que je faisais du duplicate content à gogo, d'où ma chute dans le positionnement google.

J'ai donc mis en place un petit script mais qui me posent problème :


Code PHP :
Pour copier le contenu exact du code,
Veuillez citer le message
  1. <?php  
  2. #####!!!#####
  3.  
  4.  
  5. if($_SERVER['REQUEST_URI'] == "/index.php")
  6.  
  7. {
  8.  
  9. header("HTTP/1.1 301 Moved Permanently");
  10.  
  11. header("Location: http://".$_SERVER['HTTP_HOST']."/");
  12.  
  13.  exit;
  14.  
  15.  die("Redirection");
  16.  
  17. }
  18.  
  19.  
  20.  
  21. if(preg_match("/\bmod=forum&ac=voir&id=\b/i",$_SERVER['QUERY_STRING']))
  22.  
  23. {
  24.  
  25. header("Status: 301 Moved Permanently", false, 301);
  26.  
  27.  
  28.  
  29. $q = reqmysql('SELECT `titre`,`ref` FROM `forum_topic` WHERE `id` = "'.(int)$_GET['id'].'"');
  30.  
  31. $d = mysql_fetch_object($q);
  32.  
  33.  
  34.  
  35. header('Location: http://www.bouliz.com/'.url_rewriting($d->titre).'-'.(int)$_GET['id'].'-v'.$d->ref.'.html');
  36.  
  37. exit();
  38.  
  39. }
  40.  
  41.  
  42.  
  43. if(preg_match("/\bmod=articles&ac=commentaires&id=\b/i",$_SERVER['QUERY_STRING']))
  44.  
  45. {
  46.  
  47. header("Status: 301 Moved Permanently", false, 301);
  48.  
  49.  
  50.  
  51. $q = reqmysql('SELECT `titre` FROM `articles` WHERE `id` = "'.(int)$_GET['id'].'"');
  52.  
  53. $d = mysql_fetch_object($q);
  54.  
  55.  
  56.  
  57. header('Location: http://www.bouliz.com/articles-'.url_rewriting($d->titre).'-'.(int)$_GET['id'].'.html');
  58.  
  59. exit();
  60.  
  61. }
  62.  
  63.  
  64. #####!!!#####
  65. ?>


pour le moment cela fonctionne très bien, lorsque je tape mes urls du genre index.php?mod=forum&ac=voir&id=XXX, l'url est bien redirigée, mais google a trouvé une autre url d'accès...enfin "pleins" d'autres du genre index.php?mod=forum&ac=voir&cat=XXX&id=XXX

Si je fais


Code PHP :
Pour copier le contenu exact du code,
Veuillez citer le message
  1. <?php  
  2. #####!!!#####
  3.  
  4.  
  5. if($_SERVER['REQUEST_URI'] == "/index.php")
  6.  
  7. {
  8.  
  9. header("HTTP/1.1 301 Moved Permanently");
  10.  
  11. header("Location: http://".$_SERVER['HTTP_HOST']."/");
  12.  
  13.  exit;
  14.  
  15.  die("Redirection");
  16.  
  17. }
  18.  
  19.  
  20.  
  21. if(preg_match("/\bmod=forum&ac=voir&id=\b/i",$_SERVER['QUERY_STRING']))
  22.  
  23. {
  24.  
  25. header("Status: 301 Moved Permanently", false, 301);
  26.  
  27.  
  28.  
  29. $q = reqmysql('SELECT `titre`,`ref` FROM `forum_topic` WHERE `id` = "'.(int)$_GET['id'].'"');
  30.  
  31. $d = mysql_fetch_object($q);
  32.  
  33.  
  34.  
  35. header('Location: http://www.bouliz.com/'.url_rewriting($d->titre).'-'.(int)$_GET['id'].'-v'.$d->ref.'.html');
  36.  
  37. exit();
  38.  
  39. }
  40.  
  41.  
  42. if(preg_match("/\bmod=forum&ac=voir&cat=\b/i",$_SERVER['QUERY_STRING']))
  43.  
  44. {
  45.  
  46. header("Status: 301 Moved Permanently", false, 301);
  47.  
  48.  
  49.  
  50. $q = reqmysql('SELECT `titre`,`ref` FROM `forum_topic` WHERE `id` = "'.(int)$_GET['id'].'"');
  51.  
  52. $d = mysql_fetch_object($q);
  53.  
  54.  
  55.  
  56. header('Location: http://www.bouliz.com/'.url_rewriting($d->titre).'-'.(int)$_GET['id'].'-v'.$d->ref.'.html');
  57.  
  58. exit();
  59.  
  60. }
  61.  
  62.  
  63. if(preg_match("/\bmod=articles&ac=commentaires&id=\b/i",$_SERVER['QUERY_STRING']))
  64.  
  65. {
  66.  
  67. header("Status: 301 Moved Permanently", false, 301);
  68.  
  69.  
  70.  
  71. $q = reqmysql('SELECT `titre` FROM `articles` WHERE `id` = "'.(int)$_GET['id'].'"');
  72.  
  73. $d = mysql_fetch_object($q);
  74.  
  75.  
  76.  
  77. header('Location: http://www.bouliz.com/articles-'.url_rewriting($d->titre).'-'.(int)$_GET['id'].'.html');
  78.  
  79. exit();
  80.  
  81. }
  82.  
  83.  
  84. #####!!!#####
  85. ?>


La ça fait planter le site, m'indiquant trop de boucle de redirections...si quelqu'un avait une soluce ça serait pas mal.

Merci et bonne journée.

Comtois , rends toi! Neni ma foi! | http://www.design.bouliz.com | http://www.bouliz.com
Modules actuels : Flash Mp3 Player | Module Google Map | Tous mes modules pour KwsPHP

Visiter son site

remonter

Infos CMS KwsPHP

Informations : Avant de poster un sujet sur le forum

Veuillez avant tout vérifiez la comparaison de vos fichiers sur votre site
Mon compte / Outils / Comparaison


La recherche avancée du forum (en ciblant au mieux les options de la recherche)
La Faq - La documentation - La documentation en vidéo - Le sujet "Install et Mise à jour"
Vous devez lire en priorité le topic de la 1.6 pour en découvrir ses fonctionnalités


Afficher

remonter

¥calfou
Modérateur
starsv5.png
Happy Dad !!!



avatar
Hors ligne

Nombre de posts: 6480 (2.54/Jour)
Inscrit(e) le: 25 juin 2006

Niveau en PHP : Avancée
Imprimer Permalien mardi 27 septembre 2011 à 10:24  

Slt,

J'ai déjà dit ici je crois que si url rw activité alors on met dans le robot.txt une interdiction pour les index.php comme ça plus de soucis.

Regarde celui sur mon site, il est comme ça depuis longtemps.

La référence en matière de Mr et Mme ont un fils, une fille

Mes modules pour KWS

Me remercier pour mon travail

Visiter son site

remonter

¥Gothicae
Modérateur
starsv5.png
Ultra Méchant


avatar
Hors ligne

Nombre de posts: 1539 (0.68/Jour)
Inscrit(e) le: 13 avril 2007

Niveau en PHP : Intermédiaire
Imprimer Permalien mardi 27 septembre 2011 à 10:46  

Ok je vais tester comme ça, y'as plus qu'a attendre smiley sg3bgg29g.gif

Merci @+

Comtois , rends toi! Neni ma foi! | http://www.design.bouliz.com | http://www.bouliz.com
Modules actuels : Flash Mp3 Player | Module Google Map | Tous mes modules pour KwsPHP

Visiter son site

remonter

Duplicate content avec url_rewriting  [2 réponses]

Les connectés : (0 membre - 10 visiteurs - 587 visites aujourd’hui) ♦ 2 074 228 visiteurs depuis le 22/06/2006