Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > fr.comp.lang.php > #3034 > unrolled thread
| Started by | pehache <pehache.7@gmail.com> |
|---|---|
| First post | 2017-05-08 19:15 +0200 |
| Last post | 2017-05-09 15:23 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to fr.comp.lang.php
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: redirections de pages en php ? pehache <pehache.7@gmail.com> - 2017-05-08 19:15 +0200
Re: redirections de pages en php ? "Pierre www.zetrader.fr" <www.zetrader.info> - 2017-05-09 15:23 +0200
| From | pehache <pehache.7@gmail.com> |
|---|---|
| Date | 2017-05-08 19:15 +0200 |
| Subject | Re: redirections de pages en php ? |
| Message-ID | <enbnctF1dt3U2@mid.individual.net> |
Le 06/05/2017 à 10:01, pehache a écrit :
> Bonjour,
>
> j'ai converti un vieux blog SPIP (conservé uniquement comme archive en
> ligne, mais qui n'est plus utilisé) en version statique en l'aspirant
> avec wget. Ca marche, mais il y a un petit souci : les adresses de type
>
> 1) http://xxx/article.php3?id_article=6296
>
> sont devenues
>
> 2) http://xxx/article.php3?id_article=6296.html
En fait plus exactement
2) http://xxx/article.php3%3Fid_article=6296.html
>
> Ce n'est pas très grave, Google va finir par réindexer le site à partir
> de la racine http://xxx/ qui est toujours valide, mais je me demande si
> il existerait un moyen simple sur le serveur pour rediriger les adresses
> invalides (1) vers les adresses valides (2) ?
>
> Je suppose qu'en créant un fichier "article.php3" qui va bien il doit y
> avoir moyen ? Mais je n'y connais (presque) rien en php...
On m'a donné par ailleurs la solution :
<?php
$id_article=$_GET["id_article"];
if (substr($id_article,-4)!="html") {
header('Location:
'.$_SERVER["SCRIPT_URI"]."%3F".$_SERVER["QUERY_STRING"].".html");
exit(); }
?>
Ca marche.
[toc] | [next] | [standalone]
| From | "Pierre www.zetrader.fr" <www.zetrader.info> |
|---|---|
| Date | 2017-05-09 15:23 +0200 |
| Message-ID | <5911c2e3$0$3305$426a74cc@news.free.fr> |
| In reply to | #3034 |
Le 08/05/2017 à 19:15, pehache a écrit :
> Le 06/05/2017 à 10:01, pehache a écrit :
>> Bonjour,
>>
>> j'ai converti un vieux blog SPIP (conservé uniquement comme archive en
>> ligne, mais qui n'est plus utilisé) en version statique en l'aspirant
>> avec wget. Ca marche, mais il y a un petit souci : les adresses de type
>>
>> 1) http://xxx/article.php3?id_article=6296
>>
>> sont devenues
>>
>> 2) http://xxx/article.php3?id_article=6296.html
>
> En fait plus exactement
>
> 2) http://xxx/article.php3%3Fid_article=6296.html
>
>>
>> Ce n'est pas très grave, Google va finir par réindexer le site à partir
>> de la racine http://xxx/ qui est toujours valide, mais je me demande si
>> il existerait un moyen simple sur le serveur pour rediriger les adresses
>> invalides (1) vers les adresses valides (2) ?
>>
>> Je suppose qu'en créant un fichier "article.php3" qui va bien il doit y
>> avoir moyen ? Mais je n'y connais (presque) rien en php...
>
> On m'a donné par ailleurs la solution :
>
> <?php
> $id_article=$_GET["id_article"];
> if (substr($id_article,-4)!="html") {
> header('Location:
> '.$_SERVER["SCRIPT_URI"]."%3F".$_SERVER["QUERY_STRING"].".html");
> exit(); }
> ?>
>
> Ca marche.
Intéressant, merci pour l'info, cela peut être intéressant dans d'autres
cas :)
--
http://zetrader.info & http://zetrader.fr
Forum http://zeforums.com - http://aribaut.com
[toc] | [prev] | [standalone]
Back to top | Article view | fr.comp.lang.php
csiph-web