Vos publications WordPress renvoient-elles une erreur 404 sur votre site ?
Cette erreur se produit lorsque vous pouvez accéder à votre zone d’administration WordPress et à votre blog, mais que lorsque vous essayez d’ouvrir une publication, vous voyez apparaître le message « 404 Not Found ».
Dans cet article, nous allons vous afficher comment corriger les publications WordPress renvoyant des erreurs 404.
Pourquoi mes articles WordPress renvoient-ils une erreur 404 ?
Il y a plusieurs raisons pour lesquelles vos articles WordPress peuvent afficher une erreur 404 « Page non trouvée ». Il peut s’agir de
- Conflits de plugins ou de thèmes : Parfois, les plugins ou les thèmes que vous avez installés sur votre site peuvent interférer avec la manière dont WordPress gère les permaliens. Cela peut entraîner des liens brisés et des erreurs 404.
- Problèmes liés au code personnalisé : Si vous avez ajouté un code personnalisé à votre site web, il se peut que des erreurs dans le code affectent les permaliens ou provoquent d’autres conflits, ce qui entraîne des erreurs 404 pour vos articles.
- Problèmes avec votre fichier .htaccess : Le fichier .htaccess joue un rôle dans la manière dont WordPress structure les URL. Si ce fichier est corrompu ou manquant, il peut entraîner des erreurs 404 pour vos articles.
Ceci étant dit, voyons comment corriger les publications WordPress renvoyant des erreurs 404. Vous pouvez utiliser les liens ci-dessous pour passer directement aux différentes solutions :
Tutoriel vidéo
Si vous préférez les instructions écrites, continuez à lire.
Méthode 1 : Vérifier les conflits de plugins ou de thèmes et les problèmes de code personnalisé
Parfois, les plugins, les thèmes ou le code personnalisé que vous avez ajouté à votre site WordPress peuvent interférer avec les permaliens ou provoquer des conflits, entraînant des erreurs 404. Nous en avons nous-mêmes fait l’expérience lorsque nous testions des outils sur notre site de démonstration.
Une façon de résoudre ce problème est de désactiver temporairement les plugins. Les plugins peuvent parfois perturber la manière dont WordPress gère les liens.
Une fois que vous avez désactivé les plugins, vous pouvez les réactiver un par un en vérifiant si l’erreur 404 réapparaît après l’activation de chaque plugin. Si l’erreur réapparaît après l’activation d’un plugin spécifique, il se peut que ce dernier soit le coupable.
Vous pouvez ensuite rechercher des solutions liées à ce plugin ou contacter le développeur du plugin pour obtenir de l’aide.
De même, votre thème WordPress peut être à l’origine du conflit.
Pour vérifier, vous pouvez temporairement passer à un thème WordPress par défaut comme Twenty Twenty-Three ou Twenty Twenty-Four. Tout ce que vous avez à faire est d’aller dans Apparence « Thèmes et de cliquer sur « Activer » sur un thème par défaut.
Si l’erreur 404 disparaît avec le thème par défaut, cela indique un conflit potentiel avec votre thème actuel. Vous pouvez alors essayer de dépanner le thème ou envisager d’utiliser un autre thème.
Vous pouvez consulter notre sélection de thèmes WordPress les plus populaires pour obtenir des recommandations.
Si vous avez récemment inséré des extraits de code sur votre site web, il se peut que des erreurs dans le code soient à l’origine des erreurs 404. Examinez attentivement le code que vous avez ajouté et voyez si vous pouvez identifier des erreurs.
Le moyen le plus sûr d’ajouter des extraits de code à WordPress est le plugin WPCode. Ce plugin vous permet d’insérer du code personnalisé sans travailler directement avec les fichiers du thème, ce qui réduit le risque de briser votre site web.
De plus, lorsque WPCode détecte une erreur dans votre code, il désactive automatiquement l’extrait et vous demande de le vérifier. Vous pouvez également utiliser le mode de test pour vérifier que votre code fonctionne avant de le transférer sur votre site web.
Si aucune de ces solutions ne fonctionne, passez à la méthode suivante, qui vous permettra de résoudre les problèmes liés aux paramètres des permaliens.
Méthode 2 : Corrigez les paramètres de votre Permalink
Les publications WordPress peuvent renvoyer des erreurs 404 en raison de problèmes liés aux règles de réécriture dans votre fichier .htaccess. Dans la plupart des cas, vous pouvez corriger le problème en mettant à jour vos Réglages permaliens.
Il suffit d’aller dans Réglages » Permaliens dans votre administration WordPress, et de cliquer sur le bouton » Enregistrer les modifications « .
Il n’est pas nécessaire d’apporter des modifications aux réglages permaliens eux-mêmes. Cela mettra à jour vos réglages permaliens et effacera les règles de réécriture.
Dans la plupart des cas, cette solution corrige l’erreur 404 des publications WordPress. Cependant, si cela ne fonctionne pas, vous devez probablement mettre à jour votre fichier .htaccess manuellement.
Méthode 3 : Mettre à jour le fichier .htaccess de WordPress
Avant de commencer, veillez à sauvegarder le fichier .htaccess de WordPress. En cas de problème, vous pourrez facilement restaurer le fichier d’origine.
Vous devez maintenant vous connecter à votre serveur à l’aide d’un client FTP tel que FileZilla ou de l’application Gestionnaire de fichiers du tableau de bord de votre hébergeur WordPress.
Ensuite, vous devrez trouver et modifier le fichier .htaccess, qui se trouve au même endroit que des dossiers comme /wp-content/ et /wp-includes/.
Il suffit de cliquer avec le bouton droit de la souris sur le fichier et de sélectionner « Droits du fichier ».
Vous pouvez rendre le fichier accessible en écriture en modifiant ses droits à 666.
Saisissez simplement « 666 » dans la case « Valeur numérique » et cliquez sur « OK ».
Ensuite, vous devez répéter les étapes de la première méthode de notre tutoriel. Une fois que vous avez fait cela, n’oubliez pas de modifier les droits pour revenir à 660.
Vous pouvez également modifier le fichier et y ajouter du code.
Une fois que vous avez ouvert le fichier .htaccess avec un éditeur/éditrices de texte, insérez simplement ce code :
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Méthode 4 : Contactez votre fournisseur d’hébergement
Si aucune des solutions ci-dessus n’a corrigé l’erreur WordPress posts returning 404, nous vous recommandons de contacter votre fournisseur d’hébergement WordPress. Il se peut qu’il y ait une erreur de leur côté, ou ils pourraient être en mesure de vous aider à dépanner le problème.
Veuillez également consulter notre guide sur la manière de demander correctement un support WordPress et de l’obtenir.
Méthode 5 : Corriger les articles WordPress qui renvoient l’erreur 404 sur les serveurs locaux
Si vous utilisez un serveur local à des fins de test, vous devrez activer mod_rewrite dans la configuration Apache de votre site MAMP, WAMP ou XAMPP.
Cela permettra à WordPress de générer des URL propres et d’éviter l’erreur 404 pour les publications et les pages sur votre serveur local.
La manière de procéder diffère selon la plateforme utilisée. Les personnes qui utilisent XAMPP peuvent ouvrir leur panneau de contrôle et cliquer sur le bouton ‘Config’ dans Actions. Sélectionnez ensuite « Apache (httpd.conf) ».
Ensuite, vous devrez trouver cette ligne #LoadModule rewrite_module modules/mod_rewrite.so
et retirer le ‘#’ pour la décommenter.
Ceci chargera le mod_rewrite.
Ensuite, trouvez toutes les instances de AllowOverride None
et modifiez-les en AllowOverride All
.
La valeur « Tous » signifie que toutes les directives peuvent être remplacées.
Une fois cela fait, vous pouvez enregistrer le fichier httpd.conf et le fermer. Ensuite, dans le panneau de contrôle XAMPP, cliquez sur « Stop » sur le module Apache et sur « Start » à nouveau pour le redémarrer.
Ensuite, retournez dans votre Tableau de bord pour voir si vos permaliens fonctionnent.
Nous espérons que cet article vous a aidé à résoudre les publications renvoyant des erreurs 404 sur WordPress. Vous pouvez également consulter notre guide des erreurs WordPress les plus courantes et comment les corriger, ainsi que nos choix d’experts pour les meilleures extensions WordPress pour développer votre site.
Si vous avez aimé cet article, veuillez alors vous abonner à notre chaîne YouTube pour obtenir des tutoriels vidéo sur WordPress. Vous pouvez également nous trouver sur Twitter et Facebook.
Syed Balkhi says
Hey WPBeginner readers,
Did you know you can win exciting prizes by commenting on WPBeginner?
Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
You can get more details about the contest from here.
Start sharing your thoughts below to stand a chance to win!
Abs says
It helps.. just on permalink, already fix my error..
Thanks for this article..
Julius says
Mine is a little different. All the pages are working fine but I get « page not found » when working in some places in the dashboard. Let’s say for example I’m creating a new page from the dashboard. When I click on publish I get a 404 error.
And I’ve tried everything above but it’s not working.
Iron65 says
Thanks for the tip!! the permalink really saved me!!! In case if any other suffered this by updating Yoast SEO or by just deleting cache, try that one, it will fix it
Monica says
I have been trying to fix this permalink issue in my site for months and now I did it with your instructions. I don’t know why I did everything you said already and after writing the 644 permissions to fix the httaccess file, it went back to non-writeable. Now I did it and fixed the permissions and wrote your code and it worked. i really don’t know which was the difference but this time it did. Maybe that I already fixed the httaccess in the original folder where I have a subfolder with my blog. That is the only thing I did differently. Thanks a lot
Rais Dar says
I am getting a 404(page not found) on my site. What should i do as i tried your methods but still error persists
Chetan says
I had faced the same kind of problem. I used to get 404 Page Not Found error for a page. But the reason was that I and used a permalink slug that was associated with some default page in WordPress. e.g. http://example.com/posts – This is WRONG. Because I cannot use ‘posts’ as permalink slug. It is already reserved for some WordPress page. When I changed it to ‘my-posts’, so that now my permalink read: http://example.com/my-posts, the error was gone!
md says
hi ,
i had same htaccess .,however , i delete it and import new one but still same .
dumb says
hay guys ….
when i change the permalink to anything other than default, my pages wont work i get this error message
« The requested URL /wordpress/home/ was not found on this server.
Apache/2.4.9 (Win64) PHP/5.5.12 Server at localhost Port 80 »
pl help me out
Ian Scofield says
I just had this with one of my websites. All of my posts worked fine except for one though. Something was bad about the URL. I had to change the post URL.
neelesh says
thanks a lot… ur website has helped me a lot of times and u guys are doing great job. i cant resist myself from thanking you…..
Hardik says
Hi Wpbeginner,
Actually I just have migrated from hostinger to one of paid hosting. After migration all things are going good. But when I have tried to edit one my post it regularly shows the following error.
« Page not found error » ‘Apologies, but the page you requested could not be found. Perhaps searching will help.
When I have landed here I have tried all the solutions which you have share.
But nothing is working for me.
Please Help.
Thanks in advance
Hardik
Adrienne says
Question? I have an url site, but the data is all new. so there are about 100 old posts that are not longer valid but linked to other sites.. How do I change it to forward to main website, so that Google Search Console can update they crawl records.
I’m looking, but I don’t see anything for posts that have been deleted and getting a 404 error.
Thanks,
David says
Thanks was having exactly that issue and this fixed it perfectly!
Mark says
Thank you! So nice to find such an easy fix for such a frustrating mysterious problem.
Xavier says
Woohoo! Thanks for this. I thought my site content had gone to the birds. Doing the permalink « Save Changes » worked instantly for me.
Pablo says
What if it doesn’t work no matter what you do?
HELP!
Fida says
Hi Pablo Which server do you use? Shared server or VPS?
Steve Jackson says
Thank you for this tip, it was a lifesaver and worked perfectly!
John says
Thank you !!!!
abhishek says
thank you very much it saved my links pretty well
Hugo Nascimento says
Hello guys,
I have the same issue with a client blog. i’m trying to build a custom form inside post page and when I enable the custom permalinks, the form cannot be accessed.
When I change permalinks to default, it works out! :/
Really strange. :/
Sarah says
Changing permalinks to default solved my problem too! Thank you!
mojamalenkost says
Thank you so much!!!
victor says
I have this problem .I can’t login to my WordPress dashboard, each time I try to it keeps giving me Error 404 not found. please help me fix this.
Dont Ask Real Name says
Your tip was a life saver. All our posts were just not visible. Your tip helped a lot.
What i did:
Updated .htaccess set CHMOD to 666 instead of 660
Clicked – > Settings -> Permalinks
Clicked on Defaults and clicked Save Changes
Again,
Clicked on Post name and clicked on Save Changes. (since i used custom url that’s why)
You just saved me a ton of headache…
Clive Wales says
That was a real life-saver – thought I’d totally screwed up a replacement site I’ve been working on, after trying to be clever with an .htaccess redirection. Thank you!
Marko Liuksiala says
Great, that worked – thank you!!
Bill says
I like the permalink structure of my posts and they seem to work. I have been using the same structure for several years.
However when I go to Settings–>Permalinks the actual structure is not even listed as one of the options available anymore.
Is this a problem?
Emily says
Hi I am having this problem and to be honest, I feel sick because I don’t know what to do. I am a novice really and scared I am going to kill my website more than I already have.
Can someone please tell me what my custom permalink should look like and what I SHOULD hav in my .htaacess file? Right now it seems blank?
WPBeginner Support says
Go to Settings » Permalinks choose a permalink structure that you like and then save your changes. Open your .htaccess file and you will notice that WordPress has automatically updated it. If it is blank and your chosen permalink structure is not working, then you can manually add this code into your .htaccess file:
# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
Administrateur
Viktor says
Yes, that was the solution! Thanks a lot. My hosting service changed these settings as I changed the URL to custom error pages but just clicking on the permalink settings fixed that.
Matthew Shelton says
« Go to Settings » Permalinks, and simply click on Save Changes button » – fantastic, that worked right away – thanks a lot!!
WPBeginner Staff says
Check the .htaccess file.
Gretchen Louise says
What about for a single post permalink that got changed and somehow created an internal redirect, and now it cannot be changed back without creating a 404 error? Trying to troubleshoot an issue for a client and wondering where those internal redirects are stored and where in the world to clear them. Thank you.
Thembi Ngema says
Dudessss. You guys are legends :)…. Must say I have learnt a lot from you in the past week
bhupendra says
hi
thanks I just updated parmalinks structure and site started working
Arpee Lazaro says
i just updated t he permalink structures are pictured in this solution and it worked like a charm. thanks!
WPBeginner Staff says
Please contact your web host.
Attiq Haroon says
I tried the solutions you mentioned in you post bhut it didn’t seems to be working. What happened actually is that I wanted to add a rule to .htaccess file so I downloaded that files from FTP and edited it and uploaded that file again replacing the original one, and then the problem popped up. I have tried a couple of fixes such as deleting and putting new .htacces with default code, removing .htacces file, etc. The only fix that is making the posts accessible is to set the permalink to default option. This makes the posts to work but it can not be a permanent Fix as it is not recommended as an SEO prespective
Please try to find a working solution on that problem
WPBeginner Staff says
backup your .htaccess file. Then delete the one from your server. Now log into WordPress admin area and go to Settings -> Permalinks choose your desired permalink structure and hit save changes.
After that connect to FTP and see if WordPress has created a new .htaccess file and it is not blank.
Attiq Haroon says
I tried that solution, It created a .htaccess file which looks fine but doesn’t work.
gui says
If you have Yoast WordPress SEO or any SEO plugin installed, check your SEO permalink section…
Tim Topham says
Hey guys – I recently received an email from Google crawl as I suddenly had a heap 500+ of lost links. It seems that at some stage I must have changed the permalink structure so that lots of the links on old posts have the post date and then post name where as they now just have the post name.
Before I go mad trying to fix 500 links in my articles manually, is there an easy way to update the hyperlinks in articles when this sort of thing happens?
Cheers,
Tim.
Manuel Moreira says
I was going insane with this 404 thing after a server move. Thanks for the help guys.
Cindy says
thank you! My sites were hacked and all internal pages showed a 404 error. saving the permalink settings fixed it! cheers!
Joe Cutroni says
Hi all, I’ve scoured the web to find help to resolve my issue, but
for the life of me cannot get anything to work. Starting just a couple
of weeks ago, all of my back end pages (home page was fine) started
turning out 404 errors on them.
The permalink that I have always used is « Custom structure » (/%category%/%postname%/)…here are some things that I’ve tried:
1 . Gone into my permalinks, clicked « save settings », and that method provides a temporary fix, maybe for an hour or two, then the 404 errors return on all secondary pages. I’ve also set my permalinks to a different option, such as « Default », but still get 404 errors shortly after.
2. Completely deleted my htaccess.php file, then went back and saved permalink settings…less than an hour later, 404 errors returned.
3. Commented out this line of code in my function.php file, also completely removed it altogether:
« $wp_rewrite->flush_rules(); ». That didn’t do anything. I’ve tried
using both « // » and « # » before it and tested…still get 404 errors.
4. De-activated all of my plugins to see it one of them was the culprit,
but after a short time, my 404 errors resumed while none of the plugins were active.
Like I said, this issue just start a few weeks ago. I use Securi
Security and had them scan my site for any malware, etc…and the site
is clean.
Can someone PLEASE help me with this? Would bigtime appreciate it!
Kyle says
Hey Joe,
Did you ever find a workable solution for this? I’ve gone through the same issues that you listed.
David says
Hey Guys!
Did you find a solution to the returning 404-error as listed above by JOE CUTRONI?
I’m dealing with the same issue?
Some Feedback would be awesome!
Thank you!
Greetings from Germany,
David
Paul says
Hey guys,
you are likely to have a virus on your site.
good luck
Paul
Katie says
This is the problem I am having. I moved from WordPress.com to .org and I am at my wits end. I understand the directions that say got admin—> settings —> permalinks. In fact, I remember when I was setting this up that I messed with that particular setting. Here’s my issues: WHERE do I find this admin–> settings–> permalinks?? Is it on my host, in the cpanel? Is it back on WP.com, or if it’s WP.org? And if it’s on WP.org I don’t have a clue how to get to all the admin features of my blog now. When I log in, it shows me my personal profile and allows me to edit it. But not any blog administration. I am at a loss and really losing my head.
Gabriel says
If I’m understanding you correctly, just type in the domain name that you activated the wp.org tool and follow it up with « /wp-admin » (for instance « www.example.com/wp-admin »)log in and on the lower left hand side you would find the settings option.
mali suresh says
how can change localhost paramalink step by step help me
Srihari K says
I had the same problem.. adding the below line in httpd.conf and restarting apache fixed it.
Options +FollowSymLinks
Kym Penrose Clayton says
Thank you thank you thank you
Iris Fritschi-Cussens says
THANK YOU from the bottom of my heart! I had to delete my .htaccess file due to a hack and then just when I thought everything was fine again nothing worked apart from the home page. Pressing Save Changes on the permalinks solved it in one.
disqus_Hct2NXneXJ says
Thanks Man. The Permalink Solution Fixed my Problem. Thanks & Cheers for You!
MEMEME says
Thanks! You are God.
L says
thanks! I was close to panic…
Thai says
Thanks for the post! But sadly I tried these with on the local and nothing worked.. Any other tips?
SemLavana says
Thank you. Saved my weekend!