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!
Farid says
Thank you very much for precious article that is useful to fixed my website problem.. i always prefer your web solution regarding in problem in wordpress cms.
Thank you..;.
WPBeginner Support says
You’re welcome, glad our guides have been helpful
Admin
Ben says
Just wanted to leave a thank you comment! Your guides on WordPress are second to none! I have learnt so much reading your blog and every time I Google a problem..I am looking for your website and that is where I will click! Great and simple instructions even on the most complicated WordPress issues…you are awesome! Thanks.
WPBeginner Support says
You’re welcome, glad you like our content and hope our guides continue to be helpful
Admin
David Naugle says
This totally worked! I just updated my PHP and dashboard and home pages was accessible but not any of my post pages.
Thx
WPBeginner Support says
You’re welcome, glad our guide was helpful
Admin
Vivian S. says
Thank You so much it saved my life! I had to move my WordPress website to a new server and it took me a whole day to fix everything. I wish WP had an easy way to do this.
WPBeginner Support says
Glad our guide was helpful, for transferring your content you would want to take a look at our article below:
https://www.wpbeginner.com/wp-tutorials/how-to-move-wordpress-to-a-new-host-or-server-with-no-downtime/
Admin
Gustavo says
Thank you guys, you’re AWESOME, ALLWAYS!
WPBeginner Support says
You’re welcome
Admin
Don Current says
I tried everything in the article with no success. What I ended up doing was choosing a different Permalink structure and saving it, and then going back to the structure I wanted and saving it. Then all was well.
WPBeginner Support says
Thanks for sharing the method that worked for you
Admin
James says
I accidentally deleted .htaccess file when doing 301 and got the 404 not found error. Your tutorial came to my rescue. Just by saving the permalinks and it worked. Thank you.
WPBeginner Support says
You’re welcome, glad our guide could help
Admin
Ivan says
Saved me! I am dealing with forces I cannot comprehend, and this explanation and tip was really helpful!
WPBeginner Support says
Glad our guide was helpful
Admin
Uwemedimo Usa says
Wow, I’m shocked at how fast this worked. I recently migrated my site from a subdomain to the root domain and none of my links were working. All I did was go to permalinks in settings and click “save changes.” That was all. Wow. And I was really scared I’d broken something. Thank you.
WPBeginner Support says
You’re welcome, glad we were able to help
Admin
DNNY says
What do you do if you cant even get into your WP
dashboard
WPBeginner Support says
For that, you would want to take a look at our article below:
https://www.wpbeginner.com/beginners-guide/beginners-guide-to-troubleshooting-wordpress-errors-step-by-step/
Admin
Katie says
Hi, thanks for the tips. I still can’t seem to fix the error. Have reset Permalinks, installed a redirect plugin (doesn’t help if wanting to redirect to the homepage). I can’t work out how to alter the .htaccess and not really confident to do it. Any other suggestions?
WPBeginner Support says
If you are using a static page ensure it is published, for the htaccess you would need to use FTP or your host’s file manager, otherwise, you would want to follow our troubleshooting guide below:
https://www.wpbeginner.com/beginners-guide/beginners-guide-to-troubleshooting-wordpress-errors-step-by-step/
Admin
Fola says
Thanks You saved me a lot of hassles
WPBeginner Support says
You’re welcome
Admin
Jill says
THANK YOU for this post! I had a primary domain that I let go and needed to move two sites on my hosting plan…. 1 to the primary domain position and 1 to an addon domain position which was formerly a subdomain position. I broke a lot of stuff. With some logical thought, I got most of it all back… EXCEPT all the pages on the primary domain site couldn’t be viewed on the live site once you clicked on them or the menu links. The home page loaded beautifully, but when you clicked a post or link… the errors popped up. This trick resolved those issues… so THANK YOU again! You saved the day!
WPBeginner Support says
You’re welcome, glad our guide was helpful
Admin
umesh says
I just change the permalink directly and it shows 404 error I couldn’t access my website it redirects me to another site which is not mine
WPBeginner Support says
You would want to reach out to your hosting provider to ensure your domain is set up properly and there isn’t any malicious code on your site.
Admin
faheem says
404 Not Found
nginx/1.10.3 (Ubuntu)
please give me solution for that
WPBeginner Support says
For nginx, at the moment you would want to reach out to your hosting provider and they should be able to assist.
Admin
Carene says
I’m busy building a website via wordpress & cpanel. I by accident deleted the url in my dashboard. Now I don’t get even access. Is their any way to fix it.
WPBeginner Support says
You would need to edit your site via phpMyAdmin similar to the article below. Instead of the users table you would need to edit the options table where you can readd your site address and url.
https://www.wpbeginner.com/beginners-guide/how-to-reset-a-wordpress-password-from-phpmyadmin/
Admin
Long Nguyen-Vu says
Just want to let you know that you’ve helped me save a lot of time searching.
Thanks so much.
WPBeginner Support says
You’re welcome, glad our guide was able to help
Admin
Jim says
OMG I LOVE YOU
updating the permalinks and all is gold
THANK YOU
WPBeginner Support says
Glad our guide was able to help
Admin
Brandon G. says
Updating permalinks fixed my 404 errors. Thanks!
WPBeginner Support says
You’re welcome
Admin
Musthafa says
Updating the permalink worked perfectly. Thanks guys!
WPBeginner Support says
You’re welcome, glad our guide was helpful
Admin
ami says
thanks its is working
WPBeginner Support says
You’re welcome, glad our guide was helpful
Admin
Heather says
Simply saving changes in my permalinks did the trick. Thank you!
WPBeginner Support says
You’re welcome, glad our guide was helpful
Admin
Ekemini Robert says
After saving changed for the permalink, it still returned the 404 error. Then I used the clear cache WP button at the top and the problem was solved.
WPBeginner Support says
Glad you were able to resolve the issue
Admin
Didar says
Thank you so much !
WPBeginner Support says
You’re welcome
Admin
Ashish Agarwal says
Thanks so much for this post. You are a lifesaver. Clicking ‘Save Changes’ on Permalinks under Settings did the job for me.
WPBeginner Support says
Glad our recommendation was able to help
Admin
Alex says
I have issues on 404 Page not found.
I tried updating the permalinks but still not working and I also checked the .htacess file in our server and it’s the same on the above sample. But still not working.
WPBeginner Support says
You may want to reach out to your hosting provider to ensure there are no issues on their end that could be a part of the issue
Admin
Luiz Felipe says
This simple solution saved me! thanks!!!!!!!
WPBeginner Support says
You’re welcome
Admin
Steve Dzwonczyk says
The 2nd method worked for me (FTP and edit of the .htaccess file). Thank you very much.
WPBeginner Support says
You’re welcome, glad our recommendation was helpful
Admin
Pranesh says
Thank you very much
WPBeginner Support says
You’re welcome
Admin
Anas says
Thank you so much for this helpful tip. Was really bugging me a lot
WPBeginner Support says
You’re welcome, glad our guide was helpful
Admin
Michelle Kwok says
thanks a lot.. it’s weird.. works at step one =)
WPBeginner Support says
You’re welcome, glad our recommendation was able to help
Admin
Steph says
This worked at step 1. Thank you!
WPBeginner Support says
You’re welcome, glad our guide could be helpful
Admin
Ishmael says
Many thanks, solved my problem.
WPBeginner Support says
You’re welcome, glad our guide was helpful
Admin
Shiraz says
This article helped me bring my website back on. Thank you.
WPBeginner Support says
You’re welcome
Admin
mariam says
Thanks for this post,it really solved my 404 error problems
WPBeginner Support says
Glad our recommendations were able to help
Admin
Tim says
Just a quick note to say thank you so much! I had just activated a CDN (learning as I go) and thought I had broken my site and went searching everywhere but here was the answer…phew!
WPBeginner Support says
Glad our guide could help
Admin
Lou Sarmiento says
Hi!
I’ve added the htaccess script, updated my wordpress but still I need to resave the permalinks. Any other solution?
Thanks!
WPBeginner Support says
If these solutions are not working, you would likely need to ensure there isn’t an error on your host’s end or you could try the recommendations in our troubleshooting guide here:
https://www.wpbeginner.com/beginners-guide/beginners-guide-to-troubleshooting-wordpress-errors-step-by-step/
Admin
Ayesha says
i have 404 error but cannot acces neither the site or the wordpress. how can you access wordpress admin to solve the problem??
WPBeginner Support says
If you’re unable to access your admin area, you would want to go through our guide below or reach out to your hosting provider:
https://www.wpbeginner.com/beginners-guide/beginners-guide-to-troubleshooting-wordpress-errors-step-by-step/
Admin
Nera says
Lifesaver! It worked! Flushing permalinks! Haleluja… THANKS!
WPBeginner Support says
Glad our recommendation could help
Admin
wajid virk says
on clicking save changes my problem Resolved, WP beginner is a part of my journey to learn WordPress more and more.
WPBeginner Support says
Glad we can be here to help
Admin
Safa says
You just saved me, Thanks
WPBeginner Support says
You’re welcome
Admin
Nora says
Thank you so much! This saved our corporate website
WPBeginner Support says
Glad our article was helpful
Admin
Mary Ann says
Will it work in 404 error of WordPress Multisite once I visit the admin dashboard of the sub-sites?
WPBeginner Support says
It would depend on the source of the error but this can certainly be one solution.
Admin
beginner says
Thank you, it solved the issue straight away!
WPBeginner Support says
Glad our article could help
Admin
Civali says
.htaccess example worked for me, tks!
WPBeginner Support says
Glad our recommendation could help
Admin
Vishwajeet says
So I checked all solutions and comments. I have same issue with a twist. I can see the pages when I am changing it to use the Page ID but not when I am selecting the Post-Name? Any solution to this? I know its weird.
WPBeginner Support says
You may want to delete the current htaccess file and if that does not fix the issue, reach out to your host to ensure there isn’t an underlying error causing the problem.
Admin
Mireille says
Hello,
I just wanted to let you know that your website is of such great help ! I built my first WordPress website and I managed to resolve many issues thanks to your articles. Thank you !
WPBeginner Support says
Thank you, glad our articles have been helpful
Admin
Benson Kanyi says
Hello Guys,
I have been facing this issue for the last three days after migrating a new site from my localhost to an online CPanel server. Having tried a million and one option from various forums, none of them could work at all. The only solution that seems to work is disabling Mod_Security in the CPanel. I just did it and it works like a champ. Thanks
WPBeginner Support says
Thanks for sharing the solution that worked for you
Admin
hüseyin says
I worked for days. It happened. cpanel mod security disable. solved the problem. Thanks BENSON
Christopher says
Worked! Thanks!
WPBeginner Support says
Glad our recommendation worked for you
Admin
Peter says
you blog saved me from disaster thanks so much. im learning so much now
WPBeginner Support says
Glad our recommendation could help
Admin