The SEO Framework : résoudre l'erreur 404 du fichier sitemap.xml sous NginX photo

The SEO Framework : corriger une erreur 404 sur sitemap.xml avec nginx

Avec WordPress, nginx et The SEO Framework, il peut arriver que l’URL /sitemap.xml renvoie une erreur 404 Not Found. Le plugin est actif, les permaliens fonctionnent, mais le sitemap refuse de s’afficher. Classique. Agaçant. Très nginx.

Dans la plupart des cas, The SEO Framework n’est pas le coupable. Le problème vient de la configuration nginx : une règle intercepte les fichiers .xml avant que WordPress puisse générer le sitemap virtuel.

Pourquoi sitemap.xml peut renvoyer une 404 sous nginx

The SEO Framework génère son sitemap dynamiquement. Cela signifie que /sitemap.xml n’est pas forcément un vrai fichier présent sur le disque. C’est une URL virtuelle servie par WordPress.

Avec Apache, WordPress peut souvent gérer ce type de réécriture via .htaccess. Avec nginx, c’est différent : il n’y a pas de fichier .htaccess lu dossier par dossier. Les règles doivent être écrites dans le server block nginx.

Si nginx tente de servir /sitemap.xml comme un fichier statique réel, il cherche un fichier nommé sitemap.xml à la racine du site. S’il n’existe pas, nginx renvoie une 404 avant même que WordPress puisse répondre.

Lire The SEO Framework : corriger une erreur 404 sur sitemap.xml avec nginx

WordPress : résoudre l'erreur "ftp_nlist() expects parameter 1 to be resource" photo

WP-CLI : lister toutes les URLs des articles publiés WordPress

WP-CLI permet de lister très rapidement les articles publiés d’un site WordPress, sans passer par l’administration. C’est pratique pour créer un export d’URLs, préparer une campagne de partage social, auditer un site, vérifier des contenus programmés, ou alimenter un outil externe.

Dans mon cas, j’avais besoin de récupérer les URLs des articles publiés pour les soumettre à SocialBee. Comme l’outil accepte des lots de 100 URLs, WP-CLI est parfait : une commande, une pagination, et c’est plié proprement.

Lister toutes les URLs des articles publiés

La commande de base est très simple :

wp post list --post_type=post --post_status=publish --field=urlLangage du code : PHP (php)

Elle retourne une URL par ligne, uniquement pour les articles publiés.

Les arguments importants sont :

  • wp post list liste les contenus WordPress.
  • --post_type=post limite la requête aux articles.
  • --post_status=publish limite la requête aux contenus publiés.
  • --field=url affiche uniquement l’URL de chaque article.

WP-CLI accepte ici les arguments de WP_Query. Vous pouvez donc filtrer les résultats comme vous le feriez dans une requête WordPress classique.

Lire WP-CLI : lister toutes les URLs des articles publiés WordPress

Portrait of African American abolitionist and writer Frederick Douglass.

African American Life and Resistance Before the Civil War

  1. Puritanism and Expansionism in Early America
  2. The American Revolution: Causes, Independence and Legacy
  3. The New American Nation: Constitution and Early Republic
  4. Jeffersonian America: Expansion, Embargo and the Road to War
  5. America’s Years of Growth: From Monroe to Jackson
  6. American Society in the Early Nineteenth Century
  7. Reform Movements in Antebellum America
  8. O’Sullivan’s Manifest Destiny: Meaning and Legacy
  9. Westward Expansion: America’s Road to the Pacific
  10. Antebellum South: Society, Slavery and Secession
  11. Life on Southern Plantations: Slavery and Resistance
  12. African American Life and Resistance Before the Civil War
  13. North and South Before the American Civil War
  14. The Road to the American Civil War, 1850–1861
  15. The American Civil War: Causes, Battles and Consequences
  16. Reconstruction After the American Civil War

Before the Civil War, African Americans lived under radically different legal conditions, from enslavement in the South to restricted freedom in Northern and Western communities. Enslaved and free Black people nevertheless built families, churches, schools and political organisations while resisting oppression through cultural survival, negotiation, escape, public protest and abolitionism.

African American life before the Civil War cannot be reduced to one experience. Most Black people in the United States were enslaved, but a substantial free population also lived in both Northern and Southern states.

Enslaved people worked on plantations, small farms, docks, construction sites, in factories and inside private households. Free Black Americans worked as sailors, artisans, domestic workers, labourers, teachers, ministers, writers and business owners, although racial discrimination restricted almost every aspect of their lives.

Black resistance also assumed many forms. Armed revolts were exceptional, but resistance occurred daily through family formation, religious practice, education, work slowdowns, preservation of culture, escape and organised political action.

Understanding this history requires more than describing what slavery did to African Americans. It also requires examining how Black people created communities, defended their humanity and influenced the struggle that eventually destroyed legal slavery.

The organisation of plantation slavery is examined separately in Life in the Plantations.

Lire African American Life and Resistance Before the Civil War