diff --git a/ecrire/urls/propres.php b/ecrire/urls/propres.php index d2dbc5aa34428dfa96d5fafd152c9645003f9cb9..b3a0f0c5a90f4d46515e4b4a7c6b960d1782a404 100644 --- a/ecrire/urls/propres.php +++ b/ecrire/urls/propres.php @@ -350,12 +350,12 @@ function urls_propres_dist(&$fond, $url) { // Migration depuis anciennes URLs ? if ($_SERVER['REQUEST_METHOD'] != 'POST') { if (preg_match( - ',(^|/)(article|breve|rubrique|mot|auteur|site)(\.php3?|[0-9]+\.html)' + ',(^|/)(article|breve|rubrique|mot|auteur|site)(\.php3?|[0-9]+(\.html)?)' .'([?&].*)?$,', $url, $regs) ) { - $type = $regs[3]; + $type = $regs[2]; $id_table_objet = id_table_objet($type); - $id_objet = intval($GLOBALS[$id_table_objet]); + $id_objet = intval(_request($id_table_objet)); } /* Compatibilite urls-page */ @@ -376,9 +376,6 @@ function urls_propres_dist(&$fond, $url) { // recuperer les arguments supplementaires (&debut_xxx=...) $reste = preg_replace('/^&/','?', preg_replace("/[?&]$id_table_objet=$id_objet/",'',$regs[5])); - $reste .= preg_replace('/&/','?', - preg_replace('/[?&]'.$type.'[=]?'.$id_objet.'/','', - substr($url, strpos($url,'?')))); redirige_par_entete("$url_propre$reste"); } } diff --git a/htaccess.txt b/htaccess.txt index 6397184fea39947c909918f37bd5169c2ed5b5e9..b05e6b7216d5aea2c56bafb6eb74d86e60042bcc 100644 --- a/htaccess.txt +++ b/htaccess.txt @@ -59,14 +59,15 @@ RewriteRule "." - [skip=100] ### # Compatibilite avec les URLS "html" (pour transition sympa) # voir fichier ecrire/urls/html.php3 -RewriteRule rubrique([0-9]+)\.html$ spip.php?page=rubrique&id_rubrique=$1 [QSA,L] -RewriteRule article([0-9]+)\.html$ spip.php?page=article&id_article=$1 [QSA,L] -RewriteRule breve([0-9]+)\.html$ spip.php?page=breve&id_breve=$1 [QSA,L] -RewriteRule mot([0-9]+)\.html$ spip.php?page=mot&id_mot=$1 [QSA,L] -RewriteRule auteur([0-9]+)\.html$ spip.php?page=auteur&id_auteur=$1 [QSA,L] -RewriteRule site([0-9]+)\.html$ spip.php?page=site&id_syndic=$1 [QSA,L] +RewriteRule ^rubrique([0-9]+)(\.html)?$ spip.php?page=rubrique&id_rubrique=$1 [QSA,L] +RewriteRule ^article([0-9]+)(\.html)?$ spip.php?page=article&id_article=$1 [QSA,L] +RewriteRule ^breve([0-9]+)(\.html)?$ spip.php?page=breve&id_breve=$1 [QSA,L] +RewriteRule ^mot([0-9]+)(\.html)?$ spip.php?page=mot&id_mot=$1 [QSA,L] +RewriteRule ^auteur([0-9]+)(\.html)?$ spip.php?page=auteur&id_auteur=$1 [QSA,L] +RewriteRule ^site([0-9]+)(\.html)?$ spip.php?page=site&id_syndic=$1 [QSA,L] # Compatibilite avec les anciennes URLS appelant directement des fichiers php -RewriteRule ^(rubrique|article|breve|mot|auteur|site|agenda|backend|backend-breves|distrib|forum|ical|plan|recherche|resume|sommaire|sommaire_texte)\.php3?$ spip.php?page=$1 [QSA,L] +RewriteRule ^(rubrique|article|breve|mot|auteur|site|agenda|backend|backend-breves|distrib|forum|ical|plan|recherche|sommaire|sommaire_texte)\.php3?$ spip.php?page=$1 [QSA,L] +RewriteRule ^resume.php[3]? spip.php?page=sommaire [QSA,L] RewriteRule ^page.php[3]? spip.php [QSA,L] RewriteRule ^spip_cal\.php3?$ spip.php?action=ical [QSA,L] RewriteRule ^spip_rss\.php3?$ spip.php?action=rss [QSA,L] @@ -99,5 +100,12 @@ RewriteRule ^(.*/)?\.svn/ - [F] # ExpiresByType image/png A3600 #</IfModule> +################################# +# gestion des erreurs 404 +# voir http://www.spip.net/fr_article3226.html +# Pour que le serveur http renvoie les erreurs 404 vers SPIP, supprimer le '#' + +# ErrorDocument 404 /spip.php?page=404 + # ###