Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
Copa WPB
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

Como corrigir o erro 404 dos posts do WordPress (passo a passo)

Nota editorial: Ganhamos uma comissão de links de parceiros no WPBeginner. As comissões não afetam as opiniões ou avaliações de nossos editores. Saiba mais sobre Processo editorial.

Suas postagens do WordPress estão retornando um erro 404 em seu site?

Esse erro ocorre quando você consegue acessar a área de administração e o blog do WordPress, mas, ao tentar abrir uma postagem, verá a mensagem “404 Not Found”.

Neste artigo, mostraremos a você como corrigir posts do WordPress que retornam erros 404.

How to fix WordPress posts returning 404 error

Quais são as causas do erro 404 dos posts do WordPress?

O WordPress é um sistema de gerenciamento de conteúdo (CMS) avançado, mas uma pequena alteração pode, às vezes, tornar seu site do WordPress inacessível.

Em alguns casos, talvez não seja possível acessar a área de administração do WordPress ou o próprio site, como no caso do erro interno do servidor ou do erro ao estabelecer uma conexão com o banco de dados.

Por outro lado, quando as publicações do WordPress estiverem retornando erros 404, você ainda poderá acessar a área de administração e ver o site do WordPress no front end. Então, ao clicar em um post de blog, você verá uma mensagem dizendo “404 Not Found” (404 não encontrado).

Embora essa mensagem de erro possa ser assustadora, ela não significa que você perdeu suas publicações no WordPress. Em vez disso, seu arquivo .htaccess provavelmente foi excluído ou algo deu errado com as regras de reescrita em seu blog.

Dito isso, vamos dar uma olhada em como corrigir posts do WordPress que retornam erros 404. Você pode usar os links abaixo para ir direto às diferentes soluções:

Tutorial em vídeo

Subscribe to WPBeginner

Se você preferir instruções por escrito, continue lendo.

Os posts do WordPress podem retornar erros 404 devido a problemas com regras de reescrita em seu arquivo .htaccess. Na maioria dos casos, você pode corrigir o problema atualizando suas configurações de permalink.

Basta acessar Configurações ” Permalinks em seu administrador do WordPress e clicar no botão “Salvar alterações”.

Check Permalinks

Não há necessidade de fazer alterações nas próprias configurações de permalink. Isso atualizará suas configurações de permalink e liberará as regras de reescrita.

Na maioria dos casos, essa solução corrige o erro 404 dos posts do WordPress. No entanto, se não funcionar para você, provavelmente precisará atualizar o arquivo .htaccess manualmente.

Método 2: Atualizar o arquivo .htaccess do WordPress

Antes de começar, certifique-se de fazer o backup do arquivo .htaccess do WordPress. Se algo der errado, você poderá restaurar facilmente o arquivo original.

Agora, você precisará se conectar ao seu servidor usando um cliente FTP como o FileZilla ou o aplicativo File Manager no painel de hospedagem do WordPress.

Em seguida, você precisará localizar e editar o arquivo .htaccess, que está localizado no mesmo local que pastas como /wp-content/ e /wp-includes/.

Basta clicar com o botão direito do mouse no arquivo e selecionar “File permissions” (Permissões de arquivo).

.htaccess file permissions

Você pode tornar o arquivo gravável alterando suas permissões para 666.

Basta digitar “666” na caixa “Valor numérico” e clicar em “OK”.

Change file attributes for the .htaccess file to 666

Em seguida, você precisa repetir as etapas do primeiro método do nosso tutorial. Depois de fazer isso, não se esqueça de alterar as permissões de volta para 660.

Você também pode editar o arquivo e adicionar código a ele.

Edit .htaccess file

Depois de abrir o arquivo .htaccess com um editor de texto, basta inserir este código:

# 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étodo 3: Entre em contato com o provedor de hospedagem

Se nenhuma das soluções acima tiver corrigido o erro de retorno 404 dos posts do WordPress, recomendamos entrar em contato com o provedor de hospedagem do WordPress. Pode haver um erro do lado deles ou eles podem ajudá-lo a solucionar o problema.

Consulte também nosso guia sobre como solicitar corretamente o suporte do WordPress e obtê-lo.

Método 4: Corrigir posts do WordPress que retornam erro 404 em servidores locais

Se estiver usando um servidor local para fins de teste, será necessário ativar o mod_rewrite na configuração do Apache do seu site MAMP, WAMP ou XAMPP.

Isso permitirá que o WordPress gere URLs limpos e evite o erro 404 para posts e páginas em seu servidor local.

A forma de fazer isso varia de acordo com a plataforma que você usa. As pessoas que usam o XAMPP podem abrir o painel de controle e clicar no botão “Config” em Actions. Em seguida, selecione “Apache (httpd.conf)”.

The Apache (httpd.conf) menu on XAMPP

Em seguida, você precisará encontrar esta linha #LoadModule rewrite_module modules/mod_rewrite.so e remover o ‘#’ para descomentá-la.

Isso carregará o mod_rewrite.

Finding the rewrite_module on httpd.conf file

Em seguida, localize todas as instâncias de AllowOverride None e altere-as para AllowOverride All.

O valor “All” significa que todas as diretivas podem ser substituídas.

Changing AllowOverride None to AllowOverride All

Uma vez concluído, você pode salvar o arquivo httpd.conf e fechá-lo. Depois disso, no painel de controle do XAMPP, clique em “Stop” (Parar) no módulo Apache e em “Start” (Iniciar) novamente para reiniciá-lo.

Em seguida, volte ao painel de administração para ver se os permalinks estão funcionando.

Esperamos que este artigo tenha ajudado você a solucionar os erros de mensagens que retornam 404 no WordPress. Talvez você também queira ver nosso guia sobre os erros mais comuns do WordPress e como corrigi-los, além de nossas escolhas de especialistas sobre os melhores plug-ins do WordPress para expandir seu site.

Se você gostou deste artigo, inscreva-se em nosso canal do YouTube para receber tutoriais em vídeo sobre o WordPress. Você também pode nos encontrar no Twitter e no Facebook.

Divulgação: Nosso conteúdo é apoiado pelo leitor. Isso significa que, se você clicar em alguns de nossos links, poderemos receber uma comissão. Veja como o WPBeginner é financiado, por que isso é importante e como você pode nos apoiar. Aqui está nosso processo editorial.

Avatar

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

O kit de ferramentas definitivo WordPress

Obtenha acesso GRATUITO ao nosso kit de ferramentas - uma coleção de produtos e recursos relacionados ao WordPress que todo profissional deve ter!

Reader Interactions

768 ComentáriosDeixe uma resposta

  1. 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!

  2. Moinuddin Waheed says

    This is one of the most occuring error for wordpress websites.
    this is really frustrating as it seems to get stuck and leading to nowhere.
    I have solved the issue by saving the permalink.
    I didn’t know about the other steps.
    I really appreciate the efforts to make it holistic by including all the steps to resolve this error.

  3. mohadese esmaeeli says

    Hello. The 404 error can be really frustrating, and we’ve all encountered it at least once. The situation becomes challenging when everything appears to be correct, there are no broken links, yet the 404 error persists. I faced this issue once, and it was resolved by adjusting the permalink settings.

  4. amir says

    Hi
    in my case, a plugin named as “WebP Express” create a htaccess file in uploads folder that restrict my access to some images.
    try rename or remove it and see if the problem still exist.

  5. Eriab Nsereko says

    Syed & the team u saved my whole entire day! My homepage was actually loading well.. but the other pages couldn’t load. So, I pasted the code in my .htaccess file and it did absolutely like magic.

    # BEGIN WordPress

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ – [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]

    # END WordPress

  6. David Helleskov Fønsbo says

    Thanks – None of the suggested solutions did work for me. Looks like the typical permalink error but it isn’t.

    Saving permalink again does not create a new .htaccess.

    • WPBeginner Support says

      If none of the methods in our guide are working for you, please reach out to your hosting provider and they should be able to help fix the issue.

      Administrador

  7. Frank Thomas says

    Thank you for this post. I was missing the .htaccess files after moving sites and of course the wordpress code in them. I’ve replaced it all and voila! We are live at 5. Thanks.

    • WPBeginner Support says

      If none of the recommendations from our guide could solve your error, please reach out to your hosting provider and they should be able to take a look and help!

      Administrador

  8. Harald says

    Hi,
    saving permalink helped me too, but it keeps returning over and over again after some days.
    I have no clue what causes it.

    • WPBeginner Support says

      If it is a constantly recurring error, we would recommend reaching out to your hosting provider and they can either look at their error logs for the site or keep an eye on your site for the specific error causing the problem.

      Administrador

  9. Jon says

    For me the problem was I forced a redirect from mydomain.com to ww.mydomain.com, but in wordpress the site URL said mydomain.com. After changing the redirection to ww.mydomain.com -> mydomain.com everything worked.

  10. Samir K Al Busaidy says

    I was panicking and thinking that my website was hacked or had malware. As I read your writing and you wrote not to worry, I began to relax. The first option (permalink) worked for me immediately…
    Thanks :-)

  11. Max Legault says

    On IIS there is no .htaccess file but the key is still the permalink settings. Just hitting Save didn’t fix it but changing the Custom Structure to Plain worked like a charm. Thanks for the push in the right direction.

  12. Steve Barnard says

    Dang! Can’t thank you enough for this – super simple fix worked perfectly – just hit save changes on the permalinks settings page and viola’ – my pages are back. Thank you!!

  13. kris says

    honestly thank you so much! without fail your site always comes thru with answers that work. thank you so much!
    (now I just wish I knew what caused it to get out of whack in the first place. oh well.)

    • WPBeginner Support says

      If none of our methods in this guide worked for you, we would recommend reaching out to the support for your hosting provider to ensure there is not an error on their end.

      Administrador

  14. Duane Wiese says

    None of the above suggestions worked so I did some further searching. I came across someone who suggested switching off the mod security under the security section in cpanel.

    I tried this and it worked. I also tested it by switching it back on after a change and then trying another change and BAM, 404 error.

    • WPBeginner Support says

      Thanks for sharing this should someone else run into this issue. Not every host allows access to that specific file but if you reach out to your host they can normally disable or change it for you :)

      Administrador

    • Dave Emma says

      Disabling ModSecurity fixed mine.
      I actually tried permalinks plus rewriting .htaccess, but that didn’t solve my problem. I’m glad I read comments. Many thanks guys for sharing.

  15. Elango says

    Thanks, it was so simple and the problem solved. No other pages were visible after I migrated to another server. I added the lines to .htaccess file and uploaded the same. Now all the pages are being displays without the 404 error and I am able to access my WP dashboard too. Thanks a lot.

  16. Islombek says

    My posts are showing 404 error after installing ssl certificate. How can I fix it? I tried everything mentioned above, but none helped.

  17. Dennis Yildirim says

    My .htaccess file is exactly the same with that code but nevertheless I did whatever in the post. did not work, saved permalinks through admin console, did not work. Manually edits, no luck. Deleted the .htaccess and recreated it by saving it from admin console, again did not work. Nothing works. Don’t know how did it even work on others?

    • WPBeginner Support says

      If none of the recommendations from our article were able to help we would recommend reaching out to your hosting provider as that can be a sign that there is an issue on your host’s end.

      Administrador

  18. Kuldeep Singh says

    You saved my day. I got this issue after transferring my site from one hosting to another. I couldn’t believe it was so simple to fix the issue. Many Thanks WpBeginner team!

  19. Rick says

    I never reply to these things but just wanted to jump on here and say thank you! I’ve been having this issue a lot and having to wait ages for support to help me and so finally had a hunt around, found this, and can now fix it myself. You legend!! Much appreciated

  20. Afan says

    One of solutions to correct the issue with the Permalink change is simply delete the .htaccess file – WordPress will recreate it again automatically.
    But, before you delete it, copy the file on your computer, just in case…

    • WPBeginner Support says

      If someone has customized their htaccess file then that would be a good idea. Otherwise, WordPress should auto regenerate the default information in the file where most wouldn’t need to worry.

      Administrador

  21. James Monroe says

    Saving the permalinks settings worked perfectly. Such a simple solution to what looked like a serious problem! Thank you!

  22. Muhammad Zeeshan says

    I’m facing 404 error while adding new plugin , theme , editing any post or product, editing any page ..
    I’ve try to save permalinks and also tried to change .htaccess .. But not this given solution is working for me.

    • WPBeginner Support says

      You would want to reach out to your hosting provider to see if you are running into any errors on their server’s end.

      Administrador

    • WPBeginner Support says

      You would use the htaccess method from this guide or reach out to your hosting provider to be able to assist you

      Administrador

    • WPBeginner Support says

      For that specific error, you would want to reach out to your hosting provider to take a look.

      Administrador

  23. Mihir says

    I’m facing a problem where this is extension of my own website after every page and I don’t know how to fix it.

    • WPBeginner Support says

      You would likely want to check under Settings>Permalinks to ensure everything is set correctly there

      Administrador

Deixe uma resposta

Obrigado por deixar um comentário. Lembre-se de que todos os comentários são moderados de acordo com nossos política de comentários, e seu endereço de e-mail NÃO será publicado. NÃO use palavras-chave no campo do nome. Vamos ter uma conversa pessoal e significativa.