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

Hur man fixar WordPress Posts som returnerar 404 Error (Step-by-Step)

Returnerar dina WordPress posts ett 404 error på din website?

Detta error inträffar när du kan komma åt din WordPress admin area och blogg, men när du försöker öppna ett inlägg, kommer du att se ”404 Not Found”.

I den här artikeln kommer vi att visa dig hur du fixar WordPress-poster som returnerar 404 error.

How to fix WordPress posts returning 404 error

Varför returnerar mina WordPress-poster ett 404 error?

Det finns flera anledningar till att dina WordPress-poster kan visa ett 404 ”Page Not Found” error. Dessa kan inkludera:

  • Konflikter med plugin eller theme: Ibland kan tillägg eller teman som du har installerat på din site störa hur WordPress hanterar permalänkar. Detta kan leda till brutna links och 404 error.
  • Problem med customize-kod: Om du har addat custom code till din website kan det finnas error i koden som påverkar permalänkar eller orsakar andra konflikter, vilket resulterar i 404-fel för dina posts.
  • Issues med din .htaccess-fil: Filen .htaccess spelar en roll för hur WordPress strukturerar URL:er. Om den här filen är skadad eller saknas kan det leda till 404 error för dina posts.

Med detta sagt, låt oss titta på hur man fixar WordPress posts som returnerar 404 error. Du kan använda länkarna under för att hoppa direkt till olika lösningar:

Vill du inte fixa 404 error själv? WPBeginners Pro-tjänster kan hjälpa dig! Med vårt prisvärda Emergency WordPress Support kan du anlita experter för att fixa 404 error, trasiga links, redirect issues och mycket mer. Sluta stressa över WordPress-problem och få dem fixade! Schemalägg tjänster för akut support för WordPress idag!

Video Tutorial

Subscribe to WPBeginner

Om du föredrar skriftliga instruktioner är det bara att fortsätta läsa.

Metod 1: Kontrollera för Plugin eller Theme Conflicts och Custom Code Issues

Ibland kan plugins, teman eller customizer-kod som du har addat till din WordPress-site störa permalänkar eller orsaka konflikter, vilket leder till 404 error. Vi har till och med upplevt det själva när vi testar tools på vår demo-site.

Ett sätt att lösa detta problem är att tillfälligt deactivate tillägg. Tillägg kan ibland störa hur WordPress hanterar links.

När du har deaktiverat plugin-programmen kan du reaktivera dem ett efter ett och samtidigt kontrollera om 404 error återkommer efter att du har aktiverat varje plugin. Om error dyker upp efter att ett specifikt tillägg aktiverats kan det vara den skyldige.

You can then search for solutions related to that plugin or contact the plugin developer for support.

På samma sätt kan ditt WordPress theme orsaka konflikten.

För att kontrollera kan du tillfälligt byta till ett standardtema för WordPress som gillar Twenty Twenty-Three eller Twenty Twenty-Four. Allt du behöver göra är att gå till Appearance Themes och klicka på ”Activate” på ett standardtema.

Activating a default WordPress theme

Om 404 error försvinner med standardtemat tyder det på en potentiell konflikt med ditt nuvarande tema. Du kan då försöka felsöka temat eller överväga att använda ett annat tema.

Du kan kontrollera vårt expertval av de mest populära WordPress teman för rekommendationer.

Om du senaste har infogat code snippets på din website kan det finnas error i koden som orsakar 404-felen. Ta en close titt på koden som du har add to och se om du kan identifiera några misstag.

Det säkraste sättet att add to code snippets till WordPress är med WPCode plugin. Detta plugin låter dig insert custom kod utan att direkt arbeta med theme-filer, vilket minskar risken för att bryta din website.

Dessutom, när WPCode upptäcker ett error i din kod, kommer det automatiskt att deactivate snippet och be dig att kontrollera det. Du kan också använda testläget för att kontrollera om din kod fungerar innan du skickar den till din live website.

WPCode error warning

Om ingen av dessa lösningar fungerar, gå vidare till nästa metod där vi troubleshootar dina permalänk-inställningar.

WordPress-poster kan returnera 404 error på grund av problem med omskrivningsregler i din .htaccess-fil. I de flesta fall kan du fixa problemet genom att updating dina permalänk-inställningar.

Gå bara till Settings ” Permalinks i din WordPress-admin och klicka på knappen ”Save Changes”.

Check Permalinks

Det finns inget behov av att göra ändringar i själva inställningarna för permalänken. This will update your permalänk settings and flush the rewrite rules.

I de flesta fall fixar den här lösningen WordPress posts 404 error. Men om det inte fungerar för dig, behöver du förmodligen updating din .htaccess-fil manuellt.

Metod 3: Update av .htaccess-filen i WordPress

Innan du börjar, se till att säkerhetskopiera din WordPress.htaccess-fil först. Om något går fel kan du enkelt återställa originalfilen.

Nu måste du ansluta till din server med hjälp av en FTP-klient som FileZilla eller File Manager-appen i din WordPress dashboard.

Därefter måste du hitta och redigera .htaccess-filen, som ligger på samma location som foldrar som gillar /wp-content/ och /wp-includes/.

Högerklicka bara på filen och välj ”File permissions”.

.htaccess file permissions

Du kan göra filen skrivbar genom att ändra dess behörighet till 666.

Du behöver bara enter ”666” i boxen ”Numeric value” och sedan clicka på ”OK”.

Change file attributes for the .htaccess file to 666

Sedan måste du upprepa stegen i den första metoden i vår tutorial. När du har gjort detta, glöm inte att ändra behörigheterna tillbaka till 660.

You can also edit the file and add code to it.

Edit .htaccess file

När du har öppnat .htaccess-filen med en textredigerare infogar du helt enkelt den här koden:

# 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

Metod 4: Kontakta din hosting provider

Om ingen av lösningarna ovan har fixat WordPress-poster som returnerar 404 error, rekommenderar vi att du kontaktar din WordPress hosting provider. Det kan finnas ett error hos dem, eller så kanske de kan hjälpa dig att troubleshoota problemet.

Vänligen se även vår guide om hur du ber om support för WordPress på rätt sätt och hur du får det.

Metod 5: Fix WordPress Posts Returning 404 Error på lokala servrar

Om du använder en lokal server för teständamål måste du aktivera mod_rewrite i Apache-konfigurationen på din MAMP-, WAMP- eller XAMPP-webbplats.

This will allow WordPress to generate clean URLs and prevent the 404 error for posts and pages on your local server.

Hur du gör detta skiljer sig åt beroende på vilken plattform du använder. Personer som använder XAMPP kan öppna sin panel och klicka på knappen ”Config” inom Actions. Välj sedan ”Apache (httpd.conf)”.

The Apache (httpd.conf) menu on XAMPP

Därefter måste du hitta den här raden #LoadModule rewrite_module modules/mod_rewrite.so och remove ’#’ för att avkommentera den.

Detta kommer att hämta mod_rewrite.

Finding the rewrite_module on httpd.conf file

Hitta sedan alla instanser av AllowOverride None och ändra dem till AllowOverride All.

Värdet ”All” innebär att alla direktiv kan åsidosättas.

Changing AllowOverride None to AllowOverride All

När du är klar kan du save filen httpd.conf och close den. Därefter klickar du på ”Stop” på Apache-modulen i XAMPP:s kontrollpanel och på ”Start” igen för att starta om den.

Gå sedan tillbaka till din adminpanel för att se om dina permalänkar fungerar.

Vi hoppas att den här artikeln hjälpte dig att lösa posterna som returnerar 404 error i WordPress. Du kanske också vill se vår guide till de vanligaste WordPress-felen och hur du fixar dem, tillsammans med våra expertval för de bästa WordPress-tilläggen för att utveckla din site.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Avslöjande: Vårt innehåll stöds av våra läsare. Det innebär att om du klickar på några av våra länkar, kan vi tjäna en provision. Se hur WPBeginner finansieras, varför det är viktigt, och hur du kan stödja oss. Här är vår editoriala process.

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.

Den ultimata WordPress-verktygslådan

Få GRATIS tillgång till vår verktygslåda - en samling WordPress-relaterade produkter och resurser som varje professionell användare bör ha!

Reader Interactions

773 kommentarerLämna ett svar

  1. Syed Balkhi

    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

    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!

    • WPBeginner Support

      Thanks for sharing what worked for you :)

      Administratör

  3. nebiyu amde

    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

    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

      Thanks for sharing this should someone else run into the same issue :)

      Administratör

  5. Ajit

    I’m still facing this issue.

    • WPBeginner Support

      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.

      Administratör

  6. Bunmi

    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

      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.

      Administratör

  7. Louis

    This did not work. .htaccess file is correct but nothing above helped. Still looking for a solution.

  8. miguel

    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??

  9. Rosy Allan

    THANK YOU SO MCUH! sorted :)

    • WPBeginner Support

      Glad our guide was able to help :)

      Administratör

  10. Denise

    Awesome! Thanks!

    • WPBeginner Support

      You’re welcome :)

      Administratör

  11. Lars

    thank you so much – how quick a fix :D !

    • WPBeginner Support

      Glad our guide could be helpful :)

      Administratör

  12. Avikar

    Great info, works perfectly. Got me running again

    • WPBeginner Support

      Glad our recommendations could help :)

      Administratör

  13. Vhan

    Thank you so much my site is back.

    • WPBeginner Support

      Glad our recommendations could help :)

      Administratör

  14. Gabriel Waju

    this tips really helpful…thank you so much

    • WPBeginner Support

      Glad our recommendations are helpful :)

      Administratör

  15. Theodora

    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?

  16. sudhanshu

    Thanks. This been a great help

    • WPBeginner Support

      You’re welcome :)

      Administratör

  17. Shahnawaz Ahmad

    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

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

      Administratör

  18. Victor Carlvin

    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

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

      Administratör

  19. Christos

    Thank you, i was just getting ready to jump off the building
    but your post saved me!

    • WPBeginner Support

      Glad our post could help solve the problem :)

      Administratör

  20. Kurnia Sudiar

    Thankssss, it works !!!!! it solved my problem :D

    • WPBeginner Support

      Awesome, glad our guide was helpful :)

      Administratör

  21. Fiona

    Hi

    Thank you very much !

    this article is really helpful and solved my problem .

    • WPBeginner Support

      Awesome, glad our article could help :)

      Administratör

  22. chioma

    The permalink solution worked for me. Thanks so much

    • WPBeginner Support

      Glad our guide could help :)

      Administratör

  23. ahmed s

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

    • WPBeginner Support

      Glad our article could help :)

      Administratör

  24. Derin

    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.

  25. Babajide Adepoju

    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.

    • WPBeginner Support

      Thanks for sharing what solved your problem :)

      Administratör

  26. Gary Leigh

    Thanks. This really helped and saved me a lot of stress.

    • WPBeginner Support

      Glad our guide could help :)

      Administratör

  27. Charles D

    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

      Glad our tip could help :)

      Administratör

  28. mark

    my issue not solve, 404 is returning when i am updating sub pages

    • WPBeginner Support

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

      Administratör

  29. Harry

    Perfect! You have saved me lots of time,
    So let me just Thank You here :)

    Cheers

    • WPBeginner Support

      You’re welcome :)

      Administratör

  30. Claudiu

    You are magic:)

    • WPBeginner Support

      Thank you :)

      Administratör

  31. Moussa

    Thanks the first method works fine for me

    • WPBeginner Support

      Glad our guide could help :)

      Administratör

  32. godfrey

    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.

    • WPBeginner Support

      Thanks for sharing what solved the issue for you :)

      Administratör

  33. Qadir Amin

    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

      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

      Administratör

  34. Dave

    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

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

      Administratör

  35. dave

    do you service any word press sites? i need help.

    • WPBeginner Support

      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.

      Administratör

      • Reddemma

        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?

        • WPBeginner Support

          You may want to try recreating your menu to update the links.

  36. Czarek

    Thank you very much! You save me with this solution :)

    • WPBeginner Support

      Glad our article could help :)

      Administratör

  37. Rephin Perez

    Thanks so much !! You have saved my day. Didnt know that Saving the permanent links would fix this issue. :)

    • WPBeginner Support

      Glad our article could help :)

      Administratör

  38. Decode Digital Market

    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.

    • WPBeginner Support

      Glad our article could help :)

      Administratör

  39. Carmen

    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!

  40. alaa mohamed

    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

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

      Administratör

  41. Mathukutty P V

    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.

    • WPBeginner Support

      Glad our article could help :)

      Administratör

  42. jeremy

    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.

  43. Alexander Londono

    you just save me a lot of time.
    it had take me 2 hours with no solution

    • WPBeginner Support

      Glad our article could help :)

      Administratör

  44. Ahmad WABBI

    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

    • WPBeginner Support

      Glad our article could help :)

      Administratör

  45. Babar Waheed

    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?

  46. Priya

    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!

  47. Baba nee

    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

  48. Sapna

    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.

  49. Dasuni

    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???

  50. Darshan Tejani

    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

      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.

      Administratör

  51. Jasmine Martin

    thank you!

    • WPBeginner Support

      You’re welcome :)

      Administratör

Lämna ett svar

Tack för att du väljer att lämna en kommentar. Tänk på att alla kommentarer modereras enligt våra policy för kommentarer, och din e-postadress kommer INTE att publiceras. Vänligen använd INTE nyckelord i namnfältet. Låt oss ha en personlig och meningsfull konversation.