Les pages mystérieuses

WRInaute discret
Bonjour à tous,

Je ne sais pas trop comment expliquer mon problème, pour être honnête, je ne suis même pas certains de poster au bon endroit. Je pense que je mieux est de prendre un exemple :

Quand je me rends sur cette page, tout va bien.
http://www.genealexis.fr/genealogie/metiers-anciens.php

Le problème, c'est que je peux aussi aller sur la page suivante:
http://www.genealexis.fr/genealogie/metiers-anciens.php/XXXXX

En remplaçant XXXX par tout ce que je veux ! Vous pouvez essayer, en remplaçant XXXXX par votre nom, par votre commune de naissance, par le nom de votre chien, par votre recette de pâtes préférée...etc.

J'ai pensé que ça pouvait venir du .htaccess, mais il me semble normal, et c'est le seul présent sur le site. Au cas où, voici son contenu. Il y aussi divers htaccess dans l'installation de Piwik, mais je ne sais pas à quoi ils servent.

Code:
ErrorDocument 404 http://www.genealexis.fr/divers/plan_du_site.php

RewriteEngine On 
RewriteCond %{HTTP_HOST} !^www.genealexis.fr [NC] 
RewriteRule (.*) http://www.genealexis.fr/$1 [QSA,R=301,L]

# BEGIN Expire headers
<IfModule mod_expires.c>
 ExpiresActive On
 ExpiresDefault "access plus 7200 seconds"
 ExpiresByType image/jpg "access plus 2592000 seconds"
 ExpiresByType image/jpeg "access plus 2592000 seconds"
 ExpiresByType image/png "access plus 2592000 seconds"
 ExpiresByType image/gif "access plus 2592000 seconds"
 AddType image/x-icon .ico
 ExpiresByType image/ico "access plus 2592000 seconds"
 ExpiresByType image/icon "access plus 2592000 seconds"
 ExpiresByType image/x-icon "access plus 2592000 seconds"
 ExpiresByType text/css "access plus 2592000 seconds"
 ExpiresByType text/javascript "access plus 2592000 seconds"
 ExpiresByType text/html "access plus 7200 seconds"
 ExpiresByType application/xhtml+xml "access plus 7200 seconds"
 ExpiresByType application/javascript A2592000
 ExpiresByType application/x-javascript "access plus 2592000 seconds"
 ExpiresByType application/x-shockwave-flash "access plus 2592000 seconds"
</IfModule>
# END Expire headers

Je suis ouvert à toutes vos suggestions. :(

A bientôt,
Alexis.
 
WRInaute accro
C'est tout à fait normal, c'est le $_SERVER['PATH_INFO']: http://php.net/manual/fr/reserved.variables.server.php
Ça px provoquer ce genre d'erreurs (à cause des liens relatifs): -http://www.genealexis.fr/genealogie/metiers-anciens.php/
PHP:
<span class="syntaxdefault"><br /></span><span class="syntaxkeyword"><?</span><span class="syntaxdefault">php <br />if </span><span class="syntaxkeyword">(!empty(</span><span class="syntaxdefault">$_SERVER</span><span class="syntaxkeyword">[</span><span class="syntaxstring">'PATH_INFO'</span><span class="syntaxkeyword">]))</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">{<br /></span><span class="syntaxdefault">    redirect</span><span class="syntaxkeyword">(...);<br />}<br />&nbsp;</span><span class="syntaxdefault"></span>
 
WRInaute discret
Super ! Je viens de tester en local, on dirait que ça marche !

J'ai mis ce bout de code au début de mon fichier metiers-anciens.php, juste avant le <!doctype html>

PHP:
<span class="syntaxdefault"><?php <br />if </span><span class="syntaxkeyword">(!empty(</span><span class="syntaxdefault">$_SERVER</span><span class="syntaxkeyword">[</span><span class="syntaxstring">'PATH_INFO'</span><span class="syntaxkeyword">]))</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">{<br /></span><span class="syntaxdefault">   header</span><span class="syntaxkeyword">(</span><span class="syntaxstring">"location:"</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">$_SERVER</span><span class="syntaxkeyword">[</span><span class="syntaxstring">'SCRIPT_NAME'</span><span class="syntaxkeyword">]);<br />}<br /></span><span class="syntaxdefault">?></span>

Je vais faire des tests en local avant de mettre en ligne et je vous tiens au courant.

Merci beaucoup.
 
WRInaute accro
Attention qu'il faut un espace après "location:"

PHP:
<span class="syntaxdefault"><br /></span><span class="syntaxkeyword">function&nbsp;</span><span class="syntaxdefault">redirect</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">$url</span><span class="syntaxkeyword">)<br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="syntaxdefault">header</span><span class="syntaxkeyword">(</span><span class="syntaxstring">'Status:&nbsp;301&nbsp;Moved&nbsp;Permanently'</span><span class="syntaxkeyword">);<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="syntaxdefault">header</span><span class="syntaxkeyword">(</span><span class="syntaxstring">'Location:&nbsp;'&nbsp;</span><span class="syntaxkeyword">.&nbsp;</span><span class="syntaxdefault">$url</span><span class="syntaxkeyword">);<br />&nbsp;&nbsp;&nbsp;&nbsp;exit();<br />}<br />&nbsp;</span><span class="syntaxdefault"></span>
 
Haut