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

Så här spårar du enkelt 404 pages och redirectar dem i WordPress

När en användare följer en trasig länk till din webbplats visas ett 404-felmeddelande. Det är dåliga nyheter för din webbplats eftersom felet gör besökarna frustrerade och kan skada din sökmotorrankning. Det är som att ha en ”Stängt”-skylt på butiksfronten när kunderna försöker komma in!

Den goda nyheten är att det är lättare än du tror att hitta och åtgärda dessa 404-fel. På WPBeginner tycker vi att omdirigering av dessa brutna länkar till fungerande sidor förbättrar användarupplevelsen, ökar SEO och hindrar besökare från att studsa bort från vår webbplats.

I den här artikeln visar vi dig hur du enkelt spårar 404-sidor i WordPress och ställer in omdirigeringar för att leda dina besökare till rätt innehåll. Låt oss fixa de trasiga länkarna!

How to Easily Track 404 Pages and Redirect Them in WordPress

Vad är ett 404 error?

Ett 404 error är en HTTP status kod som visar att web servern inte kunde nå den page som du försöker besöka.

Det innebär att om du enter en URL till en page som inte finns, så kommer du att se error ”404 Page Not Found”.

404 Page Example

Det finns många anledningar till att 404 error uppstod. Det kan bero på att besökaren gjorde ett misstag när han eller hon enterade URL:en, att page har blivit borttagen från website eller att domain name inte längre finns.

En annan orsak till 404 error är när en page flyttades till en annan URL men inte redirectades på rätt sätt, vilket resulterade i en bruten länk.

Slutligen kan fel på servern ibland också leda till 404 error på en WordPress website.

Varför spåra och redirect 404 pages i WordPress?

Nu när du känner till de olika orsakerna till 404 error, låt oss ta en titt på varför det är extremt viktigt för webbplatsägare att spåra 404 error och fixa dem.

404 error är dåligt för användarnas upplevelse av din site. Om användarna inte kan hitta den page de letar efter kommer de troligen att lämna din site och gå till dina konkurrenter.

Det innebär att du förlorar potentiella kunder och missar en möjlighet att konvertera dina visitorer till prenumeranter.

Notis: 404 error har en negativ inverkan på din sökmotorsoptimering i WordPress. Algoritmer för search engine ranking straffar ofta webbplatser när de runar på brutna links.

För att ej nämna, dessa brutna pages kommer att leda till att du förlorar värdefulla backlinks för din website, vilket resulterar i lägre domän behörighet och en betydande insticksprogram i Google keyword ranking.

Med detta sagt, låt oss ta en titt på hur du enkelt kan spåra 404 pages och redirecta dem i WordPress. Vi kommer att täcka två olika metoder, så klicka gärna på länkarna under för att hoppa vidare till din föredragna metod:

Vill du inte hantera 404 pages och redirections på your own? WPBeginners Pro-tjänster kan hjälpa dig! Vi erbjuder prisvärd Emergency WordPress support för att snabbt felsöka och fixa issues som 404 error, broken links, redirect issues, och alla andra website problem you may have. Schemalägg tjänster för WordPress-support idag!

Video Tutorial

Subscribe to WPBeginner

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

Metod 1: Track & Redirect 404 Pages med AIOSEO (rekommenderas)

Det enklaste sättet att spåra och fixa 404 pages på din WordPress website är genom att använda All in One SEO plugin för WordPress, som också är känt som AIOSEO. Det är det bästa tillägget för sökmotorsoptimering för WordPress som används av över 3 miljoner proffs.

AIOSEO allow you to easily find pages with broken links and fix them with just a few clicks using its powerful Redirection Manager.

Det bästa med AIOSEO är att det hjälper dig att ställa in snabbare 301 redirects, vilket hjälper dig att förbättra rankningen av search engine.

För denna tutorial kommer vi att använda AIOSEO Pro-versionen eftersom den innehåller den kraftfulla Redirection Manager addon. Det finns en gratis version av AIOSEO, men den inkluderar inte 404-övervakning eller Redirection Manager.

Först måste du installera och aktivera plugin-programmet AIOSEO Pro. För mer detaljer, vänligen se vår Step-by-Step guide om hur man installerar ett plugin för WordPress.

Activate Redirects och aktivera 404 error loggar i AIOSEO

När pluginet är aktivt kan du gå till All in One SEO ” Redirects och klicka på knappen ’Activate Redirects’.

Activating Redirects in All in One SEO

Efter det måste du besöka tabben ”Settings” under Redirects och konfigurera pluginet för att hålla 404 loggar och spåra pages med broken links.

Rulla bara ner till ”Logs” sections och se till att alternativet ”404 Logs” är aktiverat. Välj sedan tidsperioden för att registrera 404 loggar med hjälp av dropdown-menyn. Vi rekommenderar inte längre än en månad för optimal prestanda för servern.

Enable 404 logs

När du är klar, fortsätt och klicka på knappen ”Save Changes”.

Du kommer nu att se en ”404 Logs” tabs i Redirects section i AIOSEO. När du först aktiverar 404 loggar kommer den här sidan inte att ha några data eftersom den bara börjar övervaka 404 pages efter att du har aktiverat inställningen.

Med tiden kommer den att visa en lista över alla URL:er som har ett 404 error. Du kommer att se hur många gånger någon har försökt besöka länken i kolumnen ”Hits” och datumet då den senast besöktes i kolumnen ”Last Accessed”.

När du har identifierat sidorna med brutna länkar kan du helt enkelt omdirigera dem genom att clicka på knappen ”Add Redirect”. Du bör redirecta URL:en till en relevant page på your website.

Click 404 logs menu option

När du klickar på knappen ser du alternativet att enter en mål-URL och välja redirect-typ från dropdown-menyn.

Du kan t.ex. flytta en page permanently genom att välja alternativet ”301 Moved Permanently”.

Add redirect

Efter det klickar du på knappen ”Add Redirect” och din brutna länk kommer nu automatiskt att redirectas till den nya mål-URL.

Clear 404 error loggar i AIOSEO

Med tiden kan storleken på din log file växa och ta upp mycket diskutrymme. Brist på diskutrymme på ett WordPress webbhotell kan lead till error. För att se till att du inte runar in i detta problem är det en bästa praxis att delete och clear 404 error loggar.

Med AIOSEO kan du enkelt ta bort alla enskilda 404 error från dina loggar genom att clicka på trash icon.

Delete 404 error log entry from AIOSEO

Du kan också bulk radera dina 404 loggar genom att gå till All in One SEO ” Tools och sedan klicka på fliken ’Database Tools’.

Nu rullar du bara ner till sektionen ”Loggar” och klickar på knappen ”Clear 404 Logs”.

Clear 404 logs from database tools

Övervakning av permalänk i AIOSEO

Notis: Förutom att spåra 404 error, kommer AIOSEO Redirect Manager också med permalänkövervakning. Detta innebär att om du tar bort en page på din site, eller ändrar URL:en för ett blogginlägg, kommer AIOSEO automatiskt att meddela dig att ställa in en redirect.

I vissa fall kan AIOSEO till och med ställa in rätt 301 redirects för you utan ansträngning.

Bonus Tips: Sätt upp snabbare 301 Redirects i WordPress med AIOSEO

AIOSEO allows you also to set up faster redirects by going to the ’Settings’ tabs and choosing the ’Web Server’ redirect method.

AIOSEO Server Level Redirects

This allows you to unlock significant speed improvements when compared to the standard WordPress/PHP redirect method.

Metod 2: Track & Redirect 404 Pages med hjälp av tillägget Redirection

Nästa metod för att spåra och redirecta 404 error är att använda det gratis Redirection Plugin för WordPress. Detta är ett avancerat tillägg, så vissa Beginnare kan tycka att det är svårare att använda.

Först måste du installera och aktivera pluginet. För mer detaljer, vänligen se vår Step-by-Step guide om hur du installerar ett WordPress plugin.

När du är aktiverad går du till Tools ” Redirection och rullar sedan ner och klickar på knappen ”Start Setup” för att ställa in dina redirects.

Start setup of Redirection plugin

Efter det kommer plugin att fråga om du gillar att övervaka permalänk ändringar i WordPress och hålla loggar av redirects och 404 fel.

Välj bara checkboxen för dessa alternativ och klicka på knappen ”Continue Setup”.

Basic setup Redirection plugin

Tillägget kommer nu att testa REST API:s status.

När statusen visar ”Good” kan du clicka på knappen ”Finish Setup”.

Rest API test in Redirection

Därefter kommer pluginet att konfigurera redirect. Detta tar flera sekunder och när det är completed måste du clicka på knappen ”Continue” och sedan på knappen ”Ready to begin!”.

Nu kan du börja redirecta dina 404 pages.

Du behöver bara enter URL:en för den page du vill redirecta i kolumnen ”Source URL”.

Därefter väljer du om du gillar att exakt matcha sökningsparametrarna, ignorera dem eller skicka dem vidare till mål-URL:en från dropdown-menyn ”Query Parameter”.

Nu måste du enter Mål URL till där 404 sidan kommer att omdirigeras, hålla gruppalternativet som ”Redirection” och klicka på knappen ”Add Redirect”.

Add new redirection

Om du vill ha fler alternativ för att ställa in omdirigering klickar du bara på kugghjulsikonen bredvid knappen ”Add Redirect”.

Du kan börja med att lägga till den gamla URL:en som visar 404 i fältet ”Source URL”, välja parametern Query som tidigare och lägga till en titel för att beskriva syftet med denna redirect.

Därefter väljer du alternativet ”Matcha” i dropdown-menyn. Du kommer att se flera alternativ, inklusive endast URL, URL och referrer, URL och användaragent, och URL och login status.

More options for add new redirection

I de flesta fall vill du använda inställningen ”URL och referrer”. Det beror på att om du ser flera 404 requests för en specifik page, så har dessa användare förmodligen clickat på samma länk till fel URL snarare än att all skrivit samma felaktiga webbadress.

Nu, när någon annan klickar på den trasiga URL: n, kommer den automatiskt att omdirigera dem till den nya platsen.

Därefter ska du se till att din action är ”Redirect to URL”. De andra alternativen är komplexa och kräver avancerad teknisk kunskap.

För redirect-typen måste du selecta ett alternativ från HTTP code dropdown. För en permanent redirect bör detta vara ”301 – Moved Permanently”.

Slutligen, enter målets URL i fältet ”Matchat mål”. När du har enter denna information trycker du bara på knappen ”Add Redirect”.

Du kan gå till den nya URL:en för att testa och se till att redirecten fungerar som den ska.

Pluginet har också alternativet att spåra 404 error loggar. Klicka bara på tabben ”404s” högst upp, så kommer pluginet att visa dig senaste 404 error som uppstod på din site sedan du installerade pluginet.

404 Logs in Redirection plugin

Obs/observera: Om du precis aktiverat pluginet Redirect kommer sidan 404 log att vara tom. Den börjar bara föra en logging av 404 error efter att pluginet har aktiverats.

Bonus: Designa en Customize 404 Page med SeedProd

Att sätta upp redirects innebär att visitorerna inte bör runna in i många 404 error pages på din WordPress website. Men om de landar på en 404 page är det en bra idé att ha en customize design som hjälper dina användare.

Att inkludera din customize branding kan göra att din 404 page ser mer ansedd ut. Att lägga till ett kontaktformulär kan allow användare att berätta för dig den adress de enter som utlöste 404 error. Du kan även inkludera links till dina populära posts eller produkter så att besökarna blir frestade att stanna kvar på din website.

Lyckligtvis är det enkelt att designa en custom 404 page med SeedProd. Det är den bästa WordPress landning page builder och kommer med massor av anpassningsbara templates för 404 pages.

Building a custom 404 page for your WordPress website

Du kan läsa mer i vår kompletta guide om hur du förbättrar din 404 page template i WordPress.

Expertguider för hantering av 404 error i WordPress

Nu när du vet hur man spårar och redirect 404 error, kanske du gillar att se några andra guider relaterade till hantering av 404 error i WordPress.

Vi hoppas att den här artikeln hjälpte dig att lära dig hur du trackar 404 pages och redirectar dem i WordPress. Du kanske också vill se vår guide om hur du ökar trafiken på din blogg på ett enkelt sätt eller våra expertval av de bästa exemplen på 404 error pages för att inspirera din website design.

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

48 kommentarerLämna ett svar

  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. Mrteesurez says

    Instead of redirection the 404 error page, why can one rebuild or customize it and make it a landing page that can even leads to conversion.
    Thanks for the article.

    • WPBeginner Support says

      You certainly can and it would depend on the use case for if a 404 page or a redirect would be better :)

      Administratör

  3. Moinuddin Waheed says

    Very often we encounter nice and intuitive 404 error pages with some navigation links to the other pages of the website.
    it is good idea to completely redirect them without them having to navigate themselves to other pages.
    Having said that, redirecting from 404 error pages, does it completely hide the error from users and just redirect behind the wall to some other pages of encountered 404 error or it shows 404 error and then redirects to other pages?

    • WPBeginner Support says

      It would depend on the specific content that would originally cause a 404, if you have a good replacement article then you can redirect to the new article.

      Redirecting would mean that your new page is shown instead of a 404 error.

      Administratör

  4. Jiří Vaněk says

    I would like to ask if it’s really a good strategy to perform redirects for 404 pages. Personally, I’ve taken the approach of creating a really nice 404 page where I apologize for the mishap and offer the reader other website content. This means showing them the latest 10 articles that might interest them. I’ve also designed the page to reduce frustration and give the reader a bit of amusement, even if they didn’t find what they were looking for. Why I’m asking: If I redirect to another page, won’t the user be confused that not only did they not find what they were looking for, but also they won’t see the information that the page doesn’t exist? Thus, preventing them from futilely searching for it and instead giving them a direct message that unfortunately, that content no longer exists?

    • WPBeginner Support says

      It heavily depends on your content, personal preference, and site for which would be best. This guide helps those who want to set up this redirect.

      Administratör

      • Jiří Vaněk says

        Just to ask additionally, is it a better practice to redirect a 404 page to the homepage or to have a custom 404 page? I want to know what Google considers a better practice. I thought a custom 404 error page was better, but now I’m not sure, as there is also talk about redirecting to the homepage, which might be confusing for both users and robots?

        • WPBeginner Support says

          IT can change over time or based on why the content is a 404 but having a 404 page is a good practice to prevent search engines from thinking a page is duplicate content if you link every page to your homepage when you have a 404 error.

  5. Ralph says

    It is very important to take care of our 404 error as it may looks very unprofessional for our viewers. Once again you guys prove All in One SEO is great tool that can take care of many things that matter.

  6. sarah hawkins says

    We moved host and build and our new build pages load fine but the crawlers still locate pages from our old host that end in .html and these bring up error 404 pages but are not in my sitemap or build.
    Will these disappear over time with new search engine crawls or do i have to do anything? Any help would be very much appreciated.

    • WPBeginner Support says

      If they are important pages then it would normally be best to redirect them to the correct URL.

      Administratör

  7. Nikolinayoga says

    Hi, can you erase the 404 URL that the crawl found (without having them among the actual pages in the dashboard)

    I want to erase them but don´t know how to ”locate them” lol
    Or in that case the only option is to redirect them to the homepage?

    Thank you

    • WPBeginner Support says

      It would depend on the specifics of what you mean. If the page does not exist then redirecting it to the home page would let search engines know the page does not exist

      Administratör

  8. Raymond Cyprian says

    Good I stumbled upon this. Had been looking for a way to redirect error 404.pages. I think this did a good job for me. Pls can I uninstall the plugin once I have completed all redirects as I already have slot of plugins and they are beginning to slow down my site.

  9. dimip says

    Nice… I have recently moved from http to https and i see in google search results both http and https links both works but i want for all non https link that the user is redirected to https. Does the above tool is what i need?
    Does google sees http to https as different website shall i use change of address tool or is enough that i have registered also the https ?
    Do you have a quide or plan to make one with easy steps http to https ?

      • Dimip says

        Thanks a lot :) I forgot to add that it was a migration from weebly to wordpress. The site is a perfect copy, all structure kept the same but at weebly was example.com/sample.html where at wordpress example.com/sample.
        I have given the new sitemap to Google and deleted the order without redirect that happened before a month plus now the https I have seen a major drop down in SEO in search results. Is there a way to recover from this? For example if I can find again the old sitemap from weebly? For the Google map section things are the same. Some advice please?

  10. Precious says

    Hello, thank you so much for this tutorial! It helped me redirect some of my 404 pages that result from my recent Blogger-WordPress move.
    However, I noticed I have A LOT of posts that need to be redirected to the right URL, judging from the number of tracked errors on the 404 tab. My question is is there a way to automate this? Some of these links are mobile links from my former blog with the m? added to them. The thing is it may take so long to do all those redirects one after the other. I am also concerned about losing the confidence of those who visit my site.
    How do I fix this? Is there a way to automatically redirect all the 404 pages to the right posts? Please help me.

  11. David Pascal says

    I have just installed it and did some redirection. I hope it works the way I expect. Anyway, its a nice plugin. Thanks for the helpful post about it.

  12. Will Franco aka Flywheel says

    Watch out with the Redirection plugin though!

    Redirection Plugin Trialing Slash Issue

    a. Issue with and without trialing /

    b. Currently, I have to setup two redirects per URL

    ​If you don’t the URL that’s not setup in redirection will 404.​

    the bug is easy to miss! and the plugin documentation doesn’t specify that you actually need to create two redirects per one.

    if you visit the target page by clicking the source first it will work

    and then if you visit the non-trailing slash it will work

    you have the visit the non-trailing slash first to get the 404 (i.e. like a visitor of your site)

    and it seems nobody is talking about this either!!!

    • Courtney says

      FYI… this is not a bug. This is what regex is for – you can check the ”regex” box to use that option. Regular expressions allow you to create 1 redirection and then tell it to redirect with or without the trailing slash. Regex is how ’normal’ htaccess file rules are created, which is what this plugin does via WP instead (unless you have it set up to use Apache or nginx). More about regex here – . GL.

  13. WPBeginner Staff says

    Redirects not only help search engines but will also help users coming from other sources. If you are confident that you will not loose any visitors then you can deactivate the plugin.

  14. AL Spaulding says

    Great little plugin. Just handled a big batch of redirects on a site with it. I have a quick question though.

    While I am aware that the plugin must stay activated for the redirects to work, how long after the big ”G” (google) has indexed the correct page(s) and ranked them accordingly wuld it be safe to remove the plugin?

    For example: if howdy/doody/funny is redirected to howdy/doody/funny/humor, and Google is now ranking and indexing howdy/doody/funny/humor, after you alert google of the repair in Webmaster Tools; is it not safe to remove the plugin then? Or is this permanent for the life of the site?

    Excuse the lengthy question. Thanks in advance. :)

  15. Silas Jura says

    Does this work if I am building a new website in WordPress (on a new domain) and replacing my site that is currently with Weebly (on our old domain)? We decided it would be easier to use a new domain (plus it’s more SEO friendly, I think) to build the new site on WordPress so the redirect would need to come from our old domain (TitanMgmtGroup.com) and redirect to the appropriate pages on our new domain (TitanPropertyManagement.co). What do you think, should I redirect the old domain or should I switch the WordPress site to the old domain once I’m done building it? Thanks for any help you can provide.

  16. Nur Ahmad Furlong says

    I really love the redirection plugin, it has however been misbehaving alot lately, I think the developers have not been keeping it up to date. It still works but can sometimes get you stuck with redirects you can’t remove even after deleting them.

    I’m sticl with a tricky problem. I converted atons of auto generated categories to tags and now have a ton of 404’s I need to somehow redirect automatically.

    Any ideas how I can bulk redirect 404 category links to the tag equavalent?

  17. Trent says

    I’ll give this plugin a try, sounds like it’ll work great. My only concern is that it will slow the site down. This leads me to a question: if I use the plugin now and fix all my 404s through 301 redirects with this app, then delete the app when I’m done redirecting all the pages, will the redirects stay, or will they go away with the app. In other words, do I need to keep the plugin installed and activated to keep the 301 redirects active? Thanks!

  18. Frank says

    And what does Google like this? Or will it give you a lowere rate?
    Google cleans up the 404 results automatically right?

  19. Brandon N. says

    What are ”match”, ”action”, and ”regular expression” used for? Was hoping that would be covered in the article.

  20. javierojuel says

    Is it better to manage the 404 error pages in the htaccess file or with this plugin? Is there a performance issue using one of these two systems?

    • wpbeginner says

      @javierojuel This plugin is a must have for pretty much every blog. It is very well optimized. The point is that you can’t track 404 pages as well as this plugin does. Also by doing the hard code way, you can screw things up if you don’t know what you are doing. Redirection protects you at least to some extent.

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.