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

Por que meus posts do WordPress estão retornando um erro 404?

Há vários motivos pelos quais seus posts do WordPress podem estar exibindo o erro 404 “Página não encontrada”. Esses motivos podem incluir:

  • Conflitos de plugin ou tema: Às vezes, os plug-ins ou temas que você instalou em seu site podem interferir na forma como o WordPress lida com os permalinks. Isso pode levar a links quebrados e erros 404.
  • Problemas de código personalizado: Se você adicionou código personalizado ao seu site, pode haver erros no código que estejam afetando os permalinks ou causando outros conflitos, resultando em erros 404 para suas postagens.
  • Problemas com seu arquivo .htaccess: O arquivo .htaccess desempenha um papel importante na forma como o WordPress estrutura os URLs. Se esse arquivo estiver corrompido ou ausente, poderá resultar em erros 404 para suas publicações.

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.

Método 1: Verifique se há conflitos de plug-ins ou temas e problemas de código personalizado

Às vezes, plugins, temas ou códigos personalizados que você adicionou ao seu site WordPress podem interferir nos permalinks ou causar conflitos, levando a erros 404. Nós mesmos já passamos por isso quando testamos ferramentas em nosso site de demonstração.

Uma maneira de resolver esse problema é desativar temporariamente os plug-ins. Às vezes, os plug-ins podem atrapalhar a maneira como o WordPress lida com os links.

Depois de desativar os plug-ins, você pode reativá-los um a um e verificar se o erro 404 reaparece após a ativação de cada plug-in. Se o erro aparecer após a ativação de um plug-in específico, ele pode ser o culpado.

Em seguida, você pode procurar soluções relacionadas a esse plug-in ou entrar em contato com o desenvolvedor do plug-in para obter suporte.

Da mesma forma, seu tema do WordPress pode estar causando o conflito.

Para verificar, você pode mudar temporariamente para um tema padrão do WordPress, como Twenty Twenty-Three ou Twenty Twenty-Four. Tudo o que você precisa fazer é acessar Appearance Temas e clicar em “Ativar” em um tema padrão.

Activating a default WordPress theme

Se o erro 404 desaparecer com o tema padrão, isso indica um possível conflito com seu tema atual. Você pode tentar solucionar o problema com o tema ou considerar o uso de um tema diferente.

Você pode dar uma olhada em nossa seleção de especialistas dos temas mais populares do WordPress para obter recomendações.

Se você inseriu recentemente trechos de código em seu site, pode haver erros no código que estão causando os erros 404. Dê uma olhada no código que você adicionou e veja se consegue identificar algum erro.

A maneira mais segura de adicionar trechos de código ao WordPress é com o plug-in WPCode. Esse plug-in permite que você insira código personalizado sem trabalhar diretamente com os arquivos do tema, reduzindo o risco de danificar seu site.

Além disso, sempre que o WPCode detectar um erro no seu código, ele desativará automaticamente o snippet e solicitará que você o verifique. Você também pode usar o modo de teste para verificar se o código funciona antes de colocá-lo no site ativo.

WPCode error warning

Se nenhuma dessas soluções funcionar, passe para o próximo método, no qual solucionaremos os problemas de suas configurações de permalink.

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 3: 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 4: 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 5: 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. Jen says

    So for me… I first deleted the WP Fastest Cache out of my Cpanel and THEN…I “bulk deactivated” all my plugins. Did a refresh…and it worked! Praise God!
    Then I activated the plugins I still needed. So far so good.
    Thanks so much!

  3. nebiyu amde says

    i have fixed it using the first method. but when i try to get back to my home page from other pages it’s showing me this error: Error establishing a database connection…how can i fix this

  4. Zeke Yoder says

    If the problem still persists, you might want to check to see if mod_security is active and causing issues.

    I ran into this on a wordpress site hosted by Dreamhost and tried all of the options listed on this page before realizing this was my issue.

    • WPBeginner Support says

      If the methods in this article are not working then you would want to reach out to your hosting provider to see if the error could be caused on that end.

      Administrador

  5. Bunmi says

    Thank you.
    I have tried deactivating my plugins; I am using theme twenty sixteen. But still, my pages keep loading “the page can’t be found” when I use the custom permalink. I have done the .htaccess, but nothing is working. The post and categories load fine, but pages won’t load unless I use the plain permalink, which is not advisable for SEO purposes.
    Please help me.

    • WPBeginner Support says

      You may want to check with your hosting provider if you haven’t done so already to see if it could be part of an error on their end.

      Administrador

  6. miguel says

    hello, thanks for the post, great.
    i have 404 error but cannot acces neither the site or the wordpress. how can you access wordpress admin to solve the problem??

  7. Theodora says

    Please i cannot even access the admin area of my page,i also can’t load the page itself at all. What can i do to solve this?

  8. Shahnawaz Ahmad says

    When i am doing same thing and when i am clicking on Save Changes it also redirecting me to my website with 404 Error

    • WPBeginner Support says

      You may want to reach out to your hosting provider to see if they are seeing any errors for your site on their end.

      Administrador

  9. Victor Carlvin says

    Came here at first, couldn’t see the solution in the post. Searched the internet for several hours, came back and decided to read the comment section, there I saw the solution to the issue.

    A plugin caused it and once I deactivate, update and reactive it, works fine thereafter. Thank you

    • WPBeginner Support says

      Thank you for letting us know what solved the issue for you in case anyone else runs into the problem :)

      Administrador

  10. ahmed s says

    thanks.. i was very close to pulling my hair out. lol.. i was getting the 404 on all my portfolio pages. yikes. easy fix.

  11. Derin says

    I have tried to click the save button on setting>permalink on my wordpress admin but the problem still persists. I can’t seem to locate the .htaccess on my FTP login. I noticed someone commented about editing the front. I tried checking out the storefront editor, but because I am not a programmer, I am being careful not to cause more damage to the theme. Any help on how to resolve the “404 Page Not Found” permalink problem. It started after a recent wordpress update.

  12. Babajide Adepoju says

    a plugin was the problem for me; I deactivated it and had to edit the page somehow. It wasn’t that nice but it worked.

  13. Charles D says

    Just have to smile, as I am not the only delighted person. Saved from 3 days of agony :-) kept getting a broken link mydomain.com/’/menu/category

    the /’/ was apparently not linking and your TIP on Go to Settings » Permalinks, and simply click on Save Changes button. worked like a charm cheers

    • WPBeginner Support says

      You may want to reach out to your hosting provider to ensure there are no issues on the hosting’s end

      Administrador

  14. godfrey says

    After trying everything stated to solve error 404 and couldn’t I decide to edit with front editor and save, vola it started working again.

  15. Qadir Amin says

    I have applied all tricks like
    Changed Permalinks
    Changed Theme
    Changed plugins

    but all in vain, how can i resolve my this error?

    • WPBeginner Support says

      If you recreated the htaccess file you may want to reach out to your hosting provider to ensure there are no errors on the host’s end

      Administrador

  16. Dave says

    The 404 error has been haunting me for last 3 days now, my problem is that I cannot access anything, no WP dashboard, no website, no cPanel, it’s turning out to be quite a disaster please help me fix this

    • WPBeginner Support says

      For a 404 on everything, you would want to start by reaching out to your hosting provider for what they see on their end.

      Administrador

    • WPBeginner Support says

      Unless I hear otherwise, we do not have a maintenance service but you can feel free to send us the issue you are running into using our contact form.

      Administrador

      • Reddemma says

        i moved my local wordpress website to server.i changed composts table pointing to server ip and replaced all local host.changed config file and comoptions table also.
        But menu links not working in server site.How can i fix this?

  17. Decode Digital Market says

    This post literally saved my life. I just had 404 error to all my posts.

    All I had to do was save changes in permalinks and it worked.

  18. Carmen says

    Thank you so much for the information, unfortunately I am still having issues. When I try to click into +Add New Page it takes me to a 404, if I click +Add New Plugin it also takes me to a 404, if I try to add anything new it will take me to a 404, my website is still in the creation process, it is not yet published. I tried to use filezilla, but after multiple attempts doesn’t connect to my file. Do you know what I should do, I would greatly appreciate your answer!

  19. alaa mohamed says

    ok so am not sure if that’s the exact same issue am having. generally, when I access my website I don’t get any 404 errors yet on my SEO audit tool it is shown that my WordPress posts preview page is coming back with a 404 error, can anyone help me get this fixed ??

    • WPBeginner Support says

      You would want to reach out to the support for your SEO tool to see if this is a known issue with the tool

      Administrador

  20. Mathukutty P V says

    Today enabled minify script/styles in swift performance lite and after that except home page all other links showed 404 error. searched and found this post and on checking found .htaccess empty, added the basic code from this post and 404 error gone. All links are working fine Thanks.

  21. jeremy says

    please help me out
    i dont know whats wrong with my WordPress website, i tried creating a new post when am done, i click on publish but it redirect me to a page not found which 404, please help me out as at now, i cant publish anything on my site nothing is working,
    thanks for your help in advance.

  22. Ahmad WABBI says

    This is a great post. I had a problem with the permalinks when I moved my WP site from a server to another. Your post saved me a lot of time searching for the reason.

    Thanks

  23. Babar Waheed says

    hi
    your all articles are easy to understand step by step with screen shots guide thanks for writing

    I have a free classified website in word press. advertisers are posting ads in my website but few of them not meet with our terms and conditions so we delete those ads when i delete ads i get a message by word press.
    (You just trashed a Post. Search engines and other websites can still send traffic to your deleted post. You should create a redirect to ensure your visitors do not get a 404 error when they click on the no longer working URL. With Yoast SEO Premium, you can easily create such redirects)

    My question is how to fix this problem without buying yoast seo premium?

  24. Priya says

    Hello,
    My website is under construction right now.
    But I still receive 404 error while logging in.
    It does not allow me to open my account on wordpress as error arrives immediately after clicking on the log in button.

    How to solve this problem so that I can assess wp to complete my website?

    Plz give me directions so that I can proceed further as soon as possible.

    Thank you!

  25. Baba nee says

    Good day, i installed a pluggin. So i can put the google addsense script to my the head section of my blog, after putting this code to the pluggin and updating my permalinks i saved it. It still telling me page not found! How do i fix the error! Is there any other way i can insert this script manually via my cpanel! Please help a brother who is so confused right now

  26. Sapna says

    These steps seem so simple. But I tried everything. Changing the rights to 666 and 664. Deleting the .htaccess file. Copying and pasting the code didn’t help either.

    I even changed the permalink settings to which I desire and rewrite all the pages by hand again. To make sure they get the name I want and to have new page id’s

    I tried literally everything. I’m really clueless now. Can you please help me.

  27. Dasuni says

    Fatal error: Class ‘Email_Before_Download_Form’ not found in /wp-content/plugins/email-before-download/includes/class-email-before-download-shortcode.php on line 65

    Why???

  28. Darshan Tejani says

    Hi. I liked the simplicity in the Tutorial. Sadly, it didn’t work for me!

    The error goes away only If I change my permalink to ‘plain’. If I change back permalink to ‘post name’, then it shows the error! I’d be grateful If you’d help me out here. Thanks anyway for the post.

    • WPBeginner Support says

      If recreating the htaccess method is not working then you would want to reach out to your hosting provider to see if the mod_rewrite rule is enabled on their server.

      Administrador

Deixe um comentário para WPBeginner Support Cancelar 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.