diff --git a/ecrire/inc/utils.php b/ecrire/inc/utils.php
index 88d7e89aba610cf7fc00f60579bebeb3a0cad802..33f491259258f062f907b6a3b498eb6db9a8c167 100644
--- a/ecrire/inc/utils.php
+++ b/ecrire/inc/utils.php
@@ -711,11 +711,13 @@ function autoriser_sans_cookie($nom)
 // Cette fonction charge le bon inc-urls selon qu'on est dans l'espace
 // public ou prive, la presence d'un (old style) inc-urls.php3, etc.
 // http://doc.spip.org/@charger_generer_url
-function charger_generer_url() {
+function charger_generer_url($prive=NULL) {
 	static $ok;
+	if ($prive===null)
+		$prive = !test_espace_prive();
 
 	// espace prive
-	if (!_DIR_RESTREINT)
+	if ($prive)
 		include_spip('inc/urls');
 
 	// espace public