I vostri articoli su WordPress restituiscono un errore 404 sul vostro sito web?
Questo errore si verifica quando è possibile accedere all’area di amministrazione di WordPress e al blog, ma quando si cerca di aprire un articolo, viene visualizzato “404: la pagina non è stata trovata”.
In questo articolo vi mostreremo come correggere gli articoli di WordPress che restituiscono errori 404.
Perché gli articoli di WordPress restituiscono un errore 404?
Ci sono diversi motivi per cui gli articoli di WordPress potrebbero mostrare un errore 404: la pagina non è stata trovata. Questi possono essere:
- Conflitti tra plugin o temi: A volte, i plugin o i temi installati sul sito possono interferire con il modo in cui WordPress gestisce i permalink. Ciò può causare la rottura dei colleghi e la comparsa di errori 404.
- Problemi di codice personalizzato: Se avete aggiunto del codice personalizzato al vostro sito web, potrebbero esserci errori nel codice che influenzano i permalink o causano altri conflitti, con conseguenti errori 404 per gli articoli.
- Problemi con il file .htaccess: Il file .htaccess ha un ruolo nel modo in cui WordPress struttura gli URL. Se questo file è danneggiato o mancante, può causare errori 404 per i vostri articoli.
Detto questo, vediamo come correggere gli articoli di WordPress che restituiscono errori 404. Potete usare i colleghi qui sotto per passare direttamente alle diverse soluzioni:
Non volete correggere da soli gli errori 404? I Servizi Pro di WPBeginner possono aiutarvi! Con la nostra conveniente Assistenza WordPress di emergenza, potete assumere esperti per la correzione di errori 404, link rotti, problemi di reindirizzamento e molto altro. Smettete di stressarvi per i problemi di WordPress e correggeteli! Programmate oggi stesso i servizi di assistenza WordPress di emergenza!
Video tutorial
Se preferite le istruzioni scritte, continuate a leggere.
Metodo 1: Verificare la presenza di conflitti tra plugin o temi e problemi di codice personalizzato
A volte, i plugin, i temi o il codice personalizzato che avete aggiunto al vostro sito WordPress possono interferire con i permalink o causare conflitti, causando errori 404. Lo abbiamo sperimentato anche noi quando testiamo gli strumenti sul nostro sito demo.
Un modo per risolvere questo problema è disattivare temporaneamente i plugin. I plugin possono talvolta disturbare il modo in cui WordPress gestisce i colleghi.
Una volta disattivati i plugin, è possibile riattivarli uno per uno, selezionando se l’errore 404 ricompare dopo aver attivato ciascun plugin. Se l’errore compare dopo aver attivato un plugin specifico, il colpevole potrebbe essere quello.
È quindi possibile cercare soluzioni relative a quel plugin o contattare lo sviluppatore del plugin per ottenere assistenza.
Allo stesso modo, il tema di WordPress potrebbe essere la causa del conflitto.
Per selezionare, è possibile passare temporaneamente a un tema predefinito di WordPress, come Twenty Twenty-Three o Twenty Twenty-Four. Basta andare in Aspetto “ Temi e fare clic su ‘Attiva’ su un tema predefinito.
Se l’errore 404 scompare con il tema predefinito, ciò indica un potenziale conflitto con il tema corrente. Si può quindi provare a risolvere il problema del tema o prendere in considerazione l’utilizzo di un tema diverso.
Potete consultare la nostra selezione di esperti dei temi WordPress più popolari per avere consigli.
Se di recente avete inserito degli snippet di codice nel vostro sito web, potrebbero esserci degli errori nel codice che causano l’errore 404. Esaminate attentamente il codice che avete aggiunto e vedete se riuscite a individuare qualche errore.
Il modo più sicuro per aggiungere frammenti di codice a WordPress è il plugin WPCode. Questo plugin consente di inserire codice personalizzato senza intervenire direttamente sui file del tema, riducendo il rischio di rottura del sito web.
Inoltre, ogni volta che WPCode individua un errore nel codice, disattiva automaticamente lo snippet e chiede di selezionarlo. È anche possibile utilizzare la modalità di test per verificare se il codice funziona prima di inviarlo al sito web.
Se nessuna di queste soluzioni funziona, passate al metodo successivo, che prevede la risoluzione dei problemi relativi alle impostazioni dei permalink.
Metodo 2: correggere le impostazioni dei permalink
Gli articoli di WordPress possono restituire errori 404 a causa di problemi con le regole di riscrittura nel file .htaccess. Nella maggior parte dei casi, è possibile correggere il problema aggiornando le impostazioni dei permalink.
Basta andare su Impostazioni ” Permalinks nell’amministrazione di WordPress e fare clic sul pulsante “Salva modifiche”.
Non è necessario modificare le impostazioni dei permalink. Questa operazione aggiornerà le impostazioni dei permalink e cancellerà le regole di riscrittura.
Nella maggior parte dei casi, questa soluzione corregge l’errore 404 degli articoli di WordPress. Tuttavia, se non funziona, probabilmente è necessario aggiornare manualmente il file .htaccess.
Metodo 3: Aggiornamento del file .htaccess di WordPress
Prima di iniziare, assicuratevi di eseguire un backup del file .htaccess di WordPress. Se qualcosa dovesse andare storto, potrete facilmente ripristinare il file originale.
A questo punto, è necessario connettersi al server utilizzando un client FTP come FileZilla o l’applicazione File Manager nella dashboard del vostro hosting WordPress.
Successivamente, dovrete trovare e modificare il file .htaccess, che si trova nella stessa posizione di cartelle come /wp-content/ e /wp-includes/.
È sufficiente fare clic con il tasto destro del mouse sul file e selezionare “Autorizzazioni file”.
È possibile rendere il file scrivibile cambiando le autorizzazioni a 666.
Inserite semplicemente “666” nella casella “Valore numerico” e fate clic su “OK”.
Quindi, è necessario ripetere i passaggi del primo metodo del nostro tutorial. Una volta fatto questo, non dimenticate di modificare le autorizzazioni in 660.
È anche possibile modificare il file e aggiungervi del codice.
Una volta aperto il file .htaccess con un editor di testo, è sufficiente inserire questo codice:
# 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
Metodo 4: contattare il fornitore di hosting
Se nessuna delle soluzioni sopra descritte ha corretto l’errore 404 degli articoli di WordPress, vi consigliamo di contattare il vostro fornitore di hosting WordPress. Potrebbe trattarsi di un errore on loro, oppure potrebbero aiutarvi a risolvere il problema.
NON SI TRADUCE la nostra guida su come richiedere correttamente l’assistenza WordPress e ottenerla.
Metodo 5: correggere gli articoli di WordPress che restituiscono l’errore 404 sui server locali
Se si utilizza un server locale a scopo di test, è necessario abilitare il mod_rewrite nella configurazione Apache del sito MAMP, WAMP o XAMPP.
Questo permetterà a WordPress di generare URL puliti e di evitare l’errore 404 per articoli e pagine sul server locale.
Il modo in cui farlo varia a seconda della piattaforma utilizzata. Chi usa XAMPP può aprire il proprio pannello di controllo e fare clic sul pulsante “Config” all’interno di Azioni. Quindi, selezionare “Apache (httpd.conf)”.
Successivamente, è necessario trovare questa riga #LoadModule rewrite_module modules/mod_rewrite.so
e rimuovere il ‘#’ per decommentarla.
Questo caricherà il mod_rewrite.
Quindi, individuare tutte le istanze di AllowOverride None
e modificarle in AllowOverride All
.
Il valore “Tutti” significa che tutte le direttive possono essere sovrascritte.
Una volta fatto, si può salvare il file httpd.conf e chiuderlo. Dopodiché, nel pannello di controllo di XAMPP, fate clic su ‘Stop’ sul modulo Apache e su ‘Start’ per riavviarlo.
Poi, tornate alla vostra Bacheca per vedere se i permalink funzionano.
Speriamo che questo articolo vi abbia aiutato a correggere gli articoli che restituiscono errori 404 in WordPress. Potreste anche voler consultare la nostra guida agli errori più comuni di WordPress e a come correggerli, insieme alle scelte dei nostri esperti sui migliori plugin WordPress per far crescere il vostro sito.
Se questo articolo vi è piaciuto, iscrivetevi al nostro canale YouTube per le esercitazioni video su WordPress. Potete trovarci anche su Twitter e 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!
Thomas Elkin II says
Unfortunately, this has not helped me. Neither solution has worked. Anyone have another suggestion(s)?
Sharma Rahul says
Gotta, thanks man !! saved my evening (y)
Javier Rodriguez says
Waooo. one week trying to find what was wrong and it was the WAMP problem. fix it with one click. thanks a lot
Ben says
Thank you. Clear advice which saved me many hours of panic.
Milan says
Finding Solution on lots of Sites…. But No Luck And after all tried the following
Settings » Permalinks, and simply click on Save Changes button.
This Worked !!
Million Thanks To Team WpBeginner….. !!
minacio says
Great help, thank you very much!
So easy!
Jeff says
I’m afraid this did not work for me. I continue to get the 404 error and it affects all links from my front page. However, if I set the Permalinks settings to “Default” everything works. I don’t want the default settings though – I want permalinks to use “Day and name.” I’ve also checked the .htaccess file and that’s okay. I’ve done the same for permissions and they’re fine too. Help!
WPBeginner Support says
Jeff did you try deleting your .htaccess file? After deleting it you need to go to Settings » Permalinks and save your desired permalinks settings.
Admin
Rick Harris says
So this tip half works for me. I only have the 404 problem on 1 post, but it’s my first one so it’s the ‘what is this blog about and what you will find here’ so its pretty important for the blog site.
See if you can figure this out.
If I set the permalinks to something like year/month/post name it works fine.
Even if I go delete the htaccess file then make the change, setting it to ‘post name’ results in that post getting the 404. It will still display on the home and category pages though.
Alejandro says
Thanks!!!
…fixing the Permalinks did it for me! (;
Gaston says
Ha ha, so easy! thanks!
Indonesian says
really helpful.. thank a lot… You’re rock man.. !!
Annie says
I went through both these options and I still am getting a 404 error. I have my permalinks set to ‘post name’ but for some reason only ONE of my posts is stuck on a different permalink structure (the post ends with /3088 instead) and it doesn’t change when I update the permalinks. I also went into my .htaccess file, and it already had the code you had above in there, but there was nothing about permissions in the file. Is there anything I can do to make this post show up? I can see it in my homepage feed but get the error when I click on it to go to the post page.
Ashleigh says
I’m having this same issue… HELP
Scotty says
yessss. thanks for this post – really saved my bacon!
Roel says
You’re a boss.
Emily Gates says
Thanks admin i was so much worry about it actually i install category plugin(because i am running my blog that is facebookstatuss.com) and after deactivation i found my single post was not show properly 404 error was displayed but now i fix it. Thanks for giving solution.
Marx says
Dude, you’re the man.
Amon Lucas says
Thanks ! Obrigado .
Somesh says
I’ve changed my theme for a little bit. And it has for different section by-default in the dashboard.
Gadgets
Video Games
How to
So, after again re-applying the theme the posts at the post section are working fine. But, the posts for those section says page not found .
How to bring those post back the post are available in the dashboard but, there thumbnails are also available on the website but when i click on that it says page not found.
sven says
thank you so much. you made my day.
Naser says
Thanks a lot. You made my day. Thanks……
Edgar says
Thanks for the info! Was in dispair, but now fine again. Had to do an extra step though. My host provider (hostnet) installed wordpress for me, so I had to get into their config panel to sync the .htacces file. Don’t know if this is more common for people using pre installed wordpress. Just letting you know
Markus Dan says
This is genius!
Thanks … you saved my day!
Dani says
Ey man, thank you very much. You saved me a lot of hours of work!
Carl says
Hi,
my problem was, that the .htaccess file was not writable.
All I had to do was set the chmod to 777, then press the “save changes” Button in the Permalinks-Options Menu. WP then properly flushed the old .htaccess settings and rewrote them.
Works, Thank You!
Ben says
Hi i had the same problem on 2 of my sites with editing the post or page ,everything else seemed to work fine. (hapened at the same time)
I fixed it by changing the permisions in cpanel/file manager to 644 for files and 755 for directory’s setings and all was restored to normal agian. so check your hosting comp for their recomended setings on file permisions.
Some how the permisions for all files and directory’s was set to 655 for ( all wp files and directory’s ).
Changing the permisions on .htaccess file alone didn’t do it for me and editing it also didn’t solve it, nor changing the permalinks. {somehow i think my problem came from my server side.}
Hope it is helpfull for someone.
Pankaj Chauhan says
I was getting the same 404 error on my blog. It was not happening with all the posts but with one specific post. After, few hours I noticed that the category name was causing the issue. so I deleted the category and recreated it with a different slug. It worked.
but i am still not sure why it happened…
Luckily, in that category, I had no posts otherwise…it would have been a problem as i had to reassign the new category to all the posts.
JP van der Meer says
Thanks a lot, it helped me!
I did delete the .htaccess
Thanks!
Manisha Sarangi says
Hello,
I have got another solution and it worked like a magic.
Just follow few steps here.
For UBUNTU :
1.You need to enable mod_rewrite in apache server
sudo a2enmod rewrite
2.You need to restart the webserver to apply the changes
sudo service apache2 restart
3.If you plan on using mod_rewrite in .htaccess files, you also need to enable the use of .htaccess files by changing AllowOverride None to AllowOverride FileInfo. For the default website, edit /etc/apache2/sites-available/default
Options Indexes FollowSymLinks MultiViews
# changed from None to FileInfo
AllowOverride FileInfo
Order allow,deny
allow from all
4.After such a change, you need to restart Apache again
sudo service apache2 restart
5.Then go to wordpress admin>settings>permalinks>select post name and save changes
It will work now.
Thanks
David Vitorino says
Thanks for this post!!
I was trying to install wordpress in koding.com VPS and your post really helped me.
the mod_rewrite was turned off in apache.
Kudos
seb okelly says
This post fixed my problem, which I had made worst fumbling around the Codex. Thank you.
Syl says
Hey there !
Thanks for your post. I have a similar issue on my wordpress blog and don’t know what to do right now. To make it short, my .htaccess file is getting overwritten over and over…
These lines :
# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
are duplicated a hundred or thousand times with NUL characters, and my .htaccess is now 1.5 Mo ! I can fix the issue by uploading a clean .htaccess, but the issue occurs a few hours/days later, again and again, and the pages of my websites just show a 404 error…
I also tried to put the htaccess file attributes to 404 instead of 604 to stop it from being rewritten, but my host doesn’t allow this and it came back to 604…
WordPress : 3.6.1 Plugins : Akismet, Anti-spam, DB Cache Reloaded Fix, Do Follow, Google Analytics for WordPress, Post Ratings, Recipe Card, Tweet, Like, Google +1 and Share, UberMenu, WordPress Database Backup, WordPress SEO, WP Sitemap Page, WP Super Cache
Any clue ?
Best regards
WPBeginner Support says
Deactivate all your plugins, if you have some custom code pasted in your theme’s functions.php file then create a back up of your existing file and then install a fresh copy of your theme. Delete your .htaccess file. Go to Settings » Permalinks and save your permalinks. Now connect to your site using FTP, wordpress would have created a new .htaccess file for you. Browse a few pages on your site’s front-end and then see if the changes in your .htaccess file reappear.
Admin
MissyLee says
Many many thanks for continuing with helping people – My child theme functions.php was the problem. Seriously, this is a great site!
Megha Verma says
Hi, I am facing problem of error 404 page not found. But it is not applicable on every post. This problem is coming 5 out of 10. Also I am using the same method creating all the post and the perma-link structure is /sample-post/. Kindly help me out from this and provide me the best solution.
Ana Villegas says
Awesome! This help me a lot, thank youuuuu! <3
Biswajit Rout says
Hi,
Thanks for the information. I have the same problem.
But now i fixed by adding the below code in my .htaccess.
# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
Thanks again for this post.
Jyo says
Hi, thanks for the info, but it doesnt work for me
Please admin can you help me out. My permalinks arent working. I have tried your method. The only way its working is by setting permalinks to default else the whole site comes down, not even the wp admin section is accessible.
WPBeginner Support says
Here is something you can try. Connect to your WordPress site using an FTP client like Filezilla. Once you are connected to your website, in Filezilla menu bar click on Server » Force showing hidden files. Find .htaccess file in your website’s root directory, download it to your computer, then delete the file from your server. Now go to WordPress admin area in your browser and click on Settings » Permalinks. Choose a permalink structure for your website and click save changes button. Hopefully this will resolve your issue.
Admin
Elizabeth says
This 404 error was driving me mad!. Thanks for this instructive information!
Decio Denis Bernardo says
Thank you.. nice and easy!
karen says
I thought I already messed up with my blog and can’t make it work again. Thanks for this nice post!
Darren says
Your are AWESOME! I had no idea what was wrong. 5 min of reading your post and a few clicks later my blog is up and running again! Thanks a TON!
Gav Reichel says
If all of the above isn’t making any difference for you, it might be worth asking your website administrator if they’ve added the following to the configuration (if using apache):
Options Indexes Includes FollowSymLinks
AllowOverride All
(This is usually defined in the virtural host section)
If not, your .htaccess file won’t be read!
(I speak from experience after spending 30 minutes trying to work that out!)
pete says
Hi, got my htaccess hacked and had to delete it. Now I get this problem. This solution only get me halfways. From the browser 404 message(before) to my custom wordpress 404 page(after permalink reset). Any ideas?
Editorial Staff says
Can you see that the .htaccess is being created? If not, then you may want to add a blank .htaccess file.
Admin
Pete says
Took me a while to get back…
The htaccess look allright. It gets updated..Still not working. Only the custom ugly permalinks. Another wp site on the same server got hacked at the same time. But on that one this fix solves the problem..
protik says
Thank you Thank you so much…had a mild panic attack when the 404 error happened…this post was a life saver!!
Rod Salm says
Permalink fix worked for me, thank you very much!
Rod Salm
Peter says
Thank you thank you thank you.
It worked.
You are right, there are so many variables that sometimes knowing what to ask is significantly more difficult that fixing the problem.
I am now able to access my blog again.
have a great day.
Peter Sitting Scribe
Allii Allee says
i have done all the steps but its still giving me this error
Error 404
The page you’ve requested can not be displayed. It appears you’ve missed your intended destination, either through a bad or outdated link, or a typo in the page you were hoping to reach.
Akhil Gupta says
first of all i want to thank you for this great tutorial.. i am not able to change the permalink from the last 2 hrs.. i was changing the .htaccess file bit it was not working out but after seeing your 404 error post i was able to figure it out now my problem solved. Thanks once again
SBC says
Thanks, it really help me to sort out the problems with my site…
Bruce Ketchum says
Thank you, WPBeginner! Your tip on clicking the Save Changes button in the WordPress Permalinks settings fixed my 404 error, which was occurring on posts and pages.
Imran Hossain says
This is a vary important tutorial for me. Today i learned 404 Not found error.
Adrian D'Amico says
I too am having this problem on a site of mine – where it keeps happening every few days even after I hit Save Changes and refresh the Permalinks. I’m guessing it’s a plugin, but I havent gone down the list deactivating and reactivating them since I’d have to wait days to find out which one is doing it. Do you think that the htaccess edit solution you describe is a permanent solution, or will the problem resurface again? thanks for any help you could provide.
Editorial Staff says
Every WordPress site using custom permalinks have that code.
Admin
Adrian says
Hello – I followed this tutorial but my site is still plagued by this problem. Is something triggering this to occur? Something like a plugin? I’ve double checked and my htaccess file always looks like what you suggest in the article, seems as if something else is going on at least in my case. thanks for any help you could provide.
Adrian says
I guess what Im asking is do you know a way to track down what is causing it (ie. which plugin, etc.)
Rich says
Do you have this in httpd.conf for webserver files – about line 220 in a default httpd.conf file. Could your host be overwriting changes you’ve made?
AllowOverride FileInfo
My webserver settings didn’t have this so despite changing this in the initial Directory settings it just wasn’t working. As soon as I did it worked.
Jay Castillo says
The question is, what is causing the problem with the htaccess file?
I encountered this problem before and I traced it to using the diggdigg wordpress plugin.
The quick fix was to save the permalink structure just like what you mentioned above, but the problem happened to me twice(404 errors on my blogposts, homepage was okay) in a week and after I removed the diggdigg plugin, it never occurred again.
I still don’t know why it happened.