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 uppdaterar du enkelt URL:er när du flyttar din site i WordPress

Vill du updating dina URL:er efter att ha flyttat din WordPress site?

Det kan vara tidskrävande att manuellt edit varje post eller page bara för att ersätta gamla site URL:er. Lyckligtvis finns det tillägg till WordPress som hjälper dig att automatisera processen med updating av gamla URL:er.

I den här artikeln visar vi hur du enkelt uppdaterar URL:er när du flyttar din WordPress site.

How to Update URLs when Moving your WordPress Site

Här är en lista över ämnen som vi kommer att täcka i den här guiden:

När behöver du updating URL:er på din site i WordPress?

Låt oss anta att du har flyttat en WordPress site till ett new domain name. Du kan då ändra WordPress-adressen och site-adressen genom att besöka Settings ” General page från din WordPress dashpanel.

Changing WordPress and site URLs

Detta ändrar dock inte de URL:er som du tidigare har addat till dina posts och pages. Det ändrar inte heller URL:erna till images som du har addat till din WordPress site.

Att ändra alla dessa URL:er manuellt i varje blogginlägg och page kan vara tidskrävande. Dessutom finns det alltid en risk att you missar några URL:er, vilket kan lead till brutna links på your website.

Därför är det viktigt att update dina URL:er när du flyttar din WordPress website.

Det hjälper till att ge en smidig användarupplevelse för dina användare, eftersom de lätt hittar den page de letar efter. Updating URL:er förbättrar också din sökmotorsoptimering i WordPress och allow search engines att hitta new content för indexering.

Sist men ej minst vill du också se till att det finns korrekta 301 redirect från din gamla domän till den nya domänen så att användare alltid omdirigeras till rätt plats.

Detta är extremt viktigt eftersom det sannolikt finns andra webbplatser som länkar till din gamla domän, inklusive inlägg på sociala medier, Google och mer.

Med detta sagt, låt oss se hur du snabbt och enkelt kan updating URL:er när du flyttar din WordPress site.

Update URL:er efter flytt av en WordPress site

Det enklaste sättet att update gamla links på din website är att använda pluginet Search & Replace Everything för WordPress. Det är ett gratis plugin för WordPress som låter dig update URL:er i dina posts, pages, images, excerpts, widgets och mycket mer.

Se dock till att du har en komplett backup av din WordPress site innan du uppdaterar alla länkar. Detta kommer att allow you att enkelt återgå tillbaka om något går fel under updating-processen.

Därefter måste du installera och aktivera Search & Replace Everything på din site. För mer detaljer, se vår Step-by-Step guide om hur du installerar ett plugin för WordPress.

Obs/observera: Det finns också en premium version av Search & Replace Everything som kommer med mer avancerade funktioner.

Efter aktivering ska du navigera till Tools ” WP Search & Replace från din WordPress adminpanel.

Först kommer du att se en section för updating av de gamla links till de new site URL:erna. Gå vidare och enter den gamla URL:en i fältet ”Search for” och den new URL:en i fältet ”Replace with”.

Enter old and new URL in Search & Replace Everything

Sedan kan du rulla ner för att välja specifika tabeller i WordPress-databasen som du vill update. Du kan uppdatera URL:er i dina posts, comments, options, user data och andra area på din site genom att kontrollera alternativen WordPress core tables i pluginet.

WordPress core-tabeller är där all data på din website organiseras och lagras. Till exempel kommer en wp_comments-tabell att ha all information om kommentarer på din site, tillsammans med data om personen som kommenterar.

Du kan också clicka på alternativet ”Select All” för att välja alla tabeller.

Klicka sedan på knappen ”Preview Search & Replace” för att fortsätta.

Select all tables in Search & Replace Everything

Pluginet kommer sedan att allow you att previewa de ändringar det kommer att göra. På så sätt behöver du inte oroa dig för att göra några misstag.

Slutligen klickar du på knappen ”Replace All”.

Preview changes and click Replace All

Pluginet kommer nu att uppdatera alla URL:er på din site till den nya domänen.

Redirect Posts & Pages efter Updating URLs

När du har uppdaterat alla URL:er på din website måste du nu ställa in 301 redirects för hela din site till den nya domänen. Detta kommer att bevara links från webbplatser som länkade till din gamla domän och förhindra 404 error.

Det enklaste sättet att utföra en fullständig redirect av webbplatsen är att använda All in One SEO (AIOSEO) plugin. Det är den bästa sökmotorsoptimeringen WordPress plugin och är betrodd av över 3 miljoner yrkesverksamma.

AIOSEO erbjuder en kraftfull redirection manager som låter dig omdirigera gamla website URL:er till new med bara några clicks. Tillägget hjälper också till att spåra 404 error på din site så att du snabbt kan hitta och fixa eventuella trasiga links.

För denna tutorial kommer vi att använda AIOSEO Pro-versionen eftersom den innehåller omdirigeringshanteraren och andra funktioner som sitemaps, custom breadcrumbs och schema markup. Du kan också prova den gratis versionen av AIOSEO för att komma igång.

Det första du behöver göra är att installera och aktivera plugin-programmet AIOSEO på din site. Om du behöver hjälp kan du vänligen läsa vår guide om hur du installerar ett plugin för WordPress.

Efter aktivering måste du gå till All in One SEO ” Dashboard från din WordPress adminpanel. Klicka nu på knappen ”Launch the Setup Wizard” för att konfigurera pluginet.

AIOSEO dashboard launch setup wizard

Allt du behöver göra är att följa stegen i Setup Wizard. För mer information, se vår detaljerade tutorial om hur du ställer in All in One SEO för WordPress.

1. Omdirigera hela webbplatsen (Full Site Redirects)

Den här metoden är mycket användbar när du slår samman två separata WordPress-webbplatser till en eller om du ska installera en ny WordPress för den nya domänen eftersom den hanterar en fullständig redirect av webbplatsen utan att lägga till någon kod.

Helt enkelt head över till All in One SEO ” Redirects från din WordPress admin area och klicka på knappen ”Activate Redirects”.

Activate AIOSEO redirects

Efter aktivering måste du navigera till tabben ”Full Omdirigera webbplats” och aktivera toggeln ”Relocate Site”.

Därefter kan du enter ditt nya domain name i alternativet ”Relocate to domain”.

Full site redirect

När du har enter din nya domän URL, glöm inte att klicka på knappen ”Save Changes” för att lagra dina inställningar. AIOSEO kommer nu att redirecta alla links på din site till den nya URL:en.

2. Setting Up Individual Post / Page Redirects

AIOSEO erbjuder också olika typer av omdirigeringsmetoder som du kan använda för att ställa in enskilda post och page redirects.

Vi rekommenderar att du väljer redirect-typen ”301 Moved Permanently”. Detta talar om för din webbläsare att page har flyttats till en ny destination permanently, och you don’t wish to move it back.

Add redirection for old links

När du har fyllt i dessa detaljer klickar du bara på knappen ”Add Redirect”.

Du kan se de olika redirects du har skapat genom att rulla ner och view the logging.

Redirection logs in AIOSEO

Du kan se URL:erna, antalet personer som besökte länken, vilken typ av omdirigering du har ställt in och även välja om du vill aktivera eller inaktivera redirecten.

I tabben ”Settings” under Redirects kan you välja att konfigurera redirects på server-nivå också, vilket är mycket snabbare. Standardmetoden är inställd på PHP, vilket är det enklaste sättet att redirecta gamla URL:er, och det kräver ingen konfiguration på serversidan.

Men you can select ’Web Server’ as the redirect method and then choose either Apache or NGINX as your web server. Vi rekommenderar inte den här metoden för Beginnare eftersom den är obligatorisk för teknisk kunskap.

Select the Redirect Method

När du uppdaterar dina URL:er till en new domän är det också viktigt att hålla ett öga på eventuella brutna länkar. Det här är länkar som inte längre finns och som visar en 404 error page. De kan uppstå om någon URL inte uppdateras ordentligt.

Med AIOSEO är det mycket enkelt att spåra och fixa 404 error pages med hjälp av Redirect Manager.

Till att börja med kan du heada över till All in One SEO ” Redirects från din WordPress dashboard.

Gå sedan vidare och klicka på fliken ”Settings” under Redirects och klicka sedan på toggle för att aktivera alternativen ”404 Logs” och ”Redirect Logs”.

Enable 404 logs

Med hjälp av AIOSEO kan du välja tidsperiod för att behålla dina 404 error loggar. Vi rekommenderar att du inte väljer längre än en månad för att WordPress ska fungera smidigt och optimalt.

När du har aktiverat dessa alternativ klickar du på knappen ”Save Changes” högst upp på sidan för att spara dina inställningar.

Du bör nu se en new ”404 Logs” tabs visas under Redirects i AIOSEO. Under den här tabben kommer pluginet att spåra och visa 404 error pages på din website.

En viktig sak att notera är att du inte kommer att se några data under fliken 404 Logging till en början. Pluginet kommer bara att börja posta brutna länkar efter att du har aktiverat inställningarna.

Men när inställningen har varit aktiv under en tid, fortsätt och klicka på fliken ”404 Logging”. Du kommer att se en lista över brutna länkar under URL-kolumnen, antalet besök under Hits-kolumnen och det senaste åtkomstdatumet.

Click 404 logs menu option

För att fixa en trasig länk klickar du helt enkelt på knappen ”Add Redirect” för respektive URL. AIOSEO kommer nu att visa alternativ för att ställa in redirect för 404 error URL.

You will have to enter the new link under the ”Target URL” field and select ”301 Moved Permanently” as the Redirect Type from the dropdown menu.

Add redirect for your broken link

Gå sedan vidare och klicka på knappen ”Add Redirect” för att fixa den trasiga länken på din website.

För att kontrollera om redirecten fungerar, besök helt enkelt den gamla URL:en. Om du blir redirectad till den nya URL:en betyder det att du utan problem har fixat 404 error pages.

Våra bästa guider för att flytta din WordPress webbplats

Nu när du vet hur du uppdaterar URL:er när du flyttar till ett nytt domain name kanske du vill läsa några av våra andra guider om hur du flyttar din website:

Vi hoppas att den här artikeln hjälpte dig att lära dig hur du uppdaterar URL:er när du flyttar din WordPress site. Du kanske också vill se vår guide om hur du får ett gratis SSL-certifikat eller våra expertval av de bästa tjänsterna för e-postmarknadsföring för småföretag.

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

129 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. Dennis Muthomi says

    I’m curious about the SEO implications of redirecting from an old domain to a new one. Does the new domain inherit the SEO authority from the old one?

    • WPBeginner Support says

      Creating a 301 redirect would help maintain the SEO authority from your original domain.

      Administratör

  3. mohadese esmaeeli says

    I know that if, for any reason, I decide to change my site’s domain, I need to consider some crucial points to preserve its SEO. How long does it take for our links to return to their previous positions in Google search results?

    • WPBeginner Support says

      There is no guaranteed timeframe for your page rankings, following the steps from this guide will help with minimizing the time the rankings may have trouble.

      Administratör

  4. Eric B says

    WOW!! This was incredibly easy and fast. I am blown away on how seamless this was. Thank you for sharing!

  5. Ben Jamir says

    I installed activated, unfortunately, it failed to change the images URL. After switching my site to https, i had to change my site address to a non-www
    Example : from http:www.example.com to https:example.com

    SSL is properly activated, my site is up but most of the images still points to the www version of my site.

    The plugin report was zero changes done for all attachment files.

    Any idea or advice will be helpful

    Thank you

    • WPBeginner Support says

      You would want to ensure the options were checked below the url and that the url you entered was correct as well for the most common reasons

      Administratör

  6. Ben Jamir says

    I am impressed with all the positive comments. I am planning to install and try this plugin for changing my image URLs.
    One thing I want to know is that if the plugin succeeds and does what it’s supposed to do, do we need to keep the plugin installed and activated?
    Once the job is done can we deactivate the plugin?
    Will deactivating the plugin reverts the changes it made ???

    Thank you

    • WPBeginner Support says

      You can delete Velvet Blues after it has updated your URLs without them being reverted

      Administratör

  7. Caroline says

    I tried Velvet Blues Update URLs, but it doesn’t work in custom fields. Is there any other way to update custom fields?

    • WPBeginner Support says

      Did you check the option for it to update custom fields? You may want to reach out to the plugin’s support if that option isn’t having it update your fields

      Administratör

  8. Abdessamad says

    Thanx for this article it was very helpful, I have a question though, Is there a way to automatically remove the old urls from my database ?

    • WPBeginner Support says

      It would depend on what you mean, this method should handle links in posts and pages but in general, if you have your old url in plugins we do not have a recommended method at the moment.

      Administratör

  9. Linda says

    Thanks for telling us about this plugin. Haven’t tried it yet, but will soon. I was working away on the subdomain we’re using to create our new site, and adding links when I suddenly thought, ”Bet these links don’t get updated automatically. Do I need to record every one I’ve created so I can update it later?”

    So glad to know there’s a plugin that will do most of this for us.j

    Thank you,

    Linda

    • WPBeginner Support says

      Well done, you can certainly update your links manually, the plugin is an option for those who don’t want to manually go through all of their content on their site to update the links :)

      Administratör

  10. Dionne says

    Hi there,

    I managed to update all textlinks using broken link checker. But buttons (wp bakery) are not affected. Will this plugin update the link in buttons too?

    • WPBeginner Support says

      You would want to check with WPBakery to see if it currently allows this type of editing

      Administratör

  11. Nidhi says

    Hey will it change all my Quicklinks in each page go my footer. I have different Quicklinks and buttons to the specific pages and all the links needs to be changed. SO will it work ???

    Also my wordpress website is under wordpress folder so the link also mention the wordpress folder on the website If I will change the folder name and then put a link in
    old saying ”www.example.test/wordpress” and
    new saying ”www.newsite.com/renamefoldername”

    SO will this work or do I manually have to change the link for each pages

    • WPBeginner Support says

      Depending on how the quick links were created it likely will not update those but it will be able to update the folder.

      Administratör

  12. Naga Kishore says

    The same issue happened on one of my client website after migration.

    when i am trying to add a new image in the slider it is not with updating the new urls & showing 404 errors.

    After using the plugin Velvet Blues Update URLs the issue is resolved. Thanks for sharing the article.

  13. Rob says

    Hey I’m having an issue,
    Whats happened is I initially changed my site URL. Now whats happened is that whenever someone clicks on my blog name (when they see my comments on another post) they get a broken link to the old URL. If anyone knows how to fix this that would be great.

    • WPBeginner Support says

      You may want to try resaving your new url and resaving your permalinks in case that was cached somewhere

      Administratör

  14. Jp says

    Hi,

    Velvet blues worked great for regular images in posts but not featured images. Do you know about a plugin that supports changing featured images URLs? I’m storing images in a different server in the new version of my site.

    • WPBeginner Support says

      It should also update featured images, you may want to reach out to the plugin’s support if it is not updating properly.

      Administratör

  15. John Doe says

    Does not work for me. However, I may be trying to do something this plugin does not support – moving from non-www to www subdomain.

  16. Asrar says

    Hi Everyone
    i want to upload my local wordpress site to online, but when i download all the files and want to change the links (localhost/websitename/ ) there is no such links available except two links. As there must be many lins to be changes bu i dont see . Why the links are missing ?
    anyone knows ?

  17. Yogi says

    The Velvet Blues Update URLs plugin is excellent. I want to share my experience with it. After i did my URL change with it. I still see the error on opening all post. I solved it by going to ”Settings > Permalinks” section and then saved my permalinks once more by clicking the ”Save Changes” button. This solved my problem and will also solve yours if you still get some error.

  18. Jhavinder says

    I am using the same domain but i have changed my hosting. After that my all images in post are not showing. How can i fix this problem.

  19. Shawn Rebelo says

    Velvet blues is great, but misses one thing. Does not change URL’s in options if URL’s are there. Say for Custom CSS. Also, anyone have issues of you changing the URL’s, see changes in the DB. But when you go edit the page, they are still say http, when they should be https? Seems to only happen with image URL’s.

  20. jan says

    I used this wonderful plugin in the past, always worked fine. But this time it only changed the full URL links, not the internal links that don’t include the full URL. Any ideas on how to fix this?

  21. Blessing Mashoko says

    I had the same issue I just changed my permalink settings to ”plain” and changed back to the permalink setting I was using and somehow it works.

  22. Priscilla says

    The plugin hasn’t been supported in over 1 year and is untested with WP version 4.9.1. Nevertheless, I gave it a try, but unsurprisingly, it didn’t work, giving a MySQL server error. So much for a once very good plugin that the developer decides to abandon!

  23. Kokila says

    Post update of URL, images are not showing up properly in wordpress admin site. Please comment on this and also URL update didn’t happen for images on Media folder

  24. Gautam Sharma says

    After migrating from local to server, I’m getting 404-File not found error. Only my Home Page is loading, rest are not working, I have changed the permalinks also! Please help…

  25. Emma Booth says

    Is there anyway I can avoid links from social media breaking once I have done a re-direct?

    I’m trying to re-direct from a wordpress.com blog to a blog on a new domain on wordpress.org, however I’m concerned previous links in tweets and linkedIn posts will break….any way to avoid this?)

  26. Neha Prajapati says

    I changed my server keeping same web URL. and properly configured.
    But why my all old post r showing in google search with page not found.
    What to do??

  27. Peter says

    I use Velvet Blues with very good results. However, it is important to note that VB will not change URL in widgets or if there are URLs in your CSS code. These will need to be manually changed.

  28. Jeremy says

    In response to ADITYA’s comment about this being a substitute for 301 redirects.

    I would say that a find and replace plugin is NOT a substitute for 301 redirects. 301 redirects are still valuable from an SEO standpoint, as well as for users who may have bookmarked or are accustomed to using your old domain.

    Just using this plugin would result in your users hitting an old site that is no longer being maintained or a site that’s been taken offline.

    On a personal note, I definitely recommend Migrate DB Pro for this type of activity. It’s worth the money, if you’re doing local development.

  29. Jennifer says

    Hi,

    Does this plug in also work for updating links that are embedded inside tables that I created with TablePress? I also have a number of URLs as part of image descriptions for photos that I added using FooGallery, and i assume that these are stored inside the database, rather than in the HTML for the pages – is Velvet Blues able to update these as well, or do I need a different plug in for that task? My site (which I am going to move from its current directory to a subdirectory of my site that I want to use for an add-on domain) contains about 13.500 images and 500 tables, and it would be extremely tedious to check every single one for links, and then manually replace them with the new URL.

    Thanks.

  30. Vidy says

    Cool plugin and great tutorial, I’ve just migrate my domain and I have 300 post. I searched exactly the plugin u reviewed. Thanks for your help. I didn’t needed to replace my internal link one by one.

  31. Michelle Z. says

    Question: I updated my theme, and the blogroll is now on a secondary page, when it used to be on the homepage. So I have the same url but different path. Check it out:

    Old Link (we want to maintain these):

    New Link:

    I tried adjusting the permalinks but its not working…yet. Any ideas?

    Thanks so much!

  32. Sourabh Saraf says

    Thanks for the wonderful tut , i usually go for backupbuddy for my migration but sometimes due to server limitations backupbuddy doesnt work . This trick comes handy everytime i manually migrate wordpress and works like a charm .
    cheers
    Sourabh

  33. Sonali says

    My old and new site urls are the same since I migrated my site content from wordpress.com to wordpress.org. Not sure how to use this and get those errors fixed…Please advice! Thanks!

  34. Melissa says

    I used this plugin after migrating from Blogger to WordPress. None of my image URLs are updating…so none of my images are currently showing on my blog (www.fitchocoholic.com). Can anyone help me with this? I’m freaking out!

  35. jatinder says

    I installed this plugin and is working perfectly.

    But my question is, why doest it work on the content build using Content Builder plugins like Visual composer or Muffin tool. i have certain hard-coded links it does change those link.

    Any comments??

    • Josh says

      Hi Jatinder.
      The reason this plugin doesn’t work for content inside Visual Composer is because Visual Composer stores the links in a strange way. If you click on ”Classic Mode” in Visual Composer you’ll see that links don’t look like proper URLs.

      For example, I have a VC button that points to this link:

      example.com/services/adwords/

      But in Classic Mode I can see that the link looks like this:
      http%3A%2F%2Fexample.com%2Fservices%2Fadwords%2F

      So this will be why Velvet Blues doesn’t change these links.

      To fix the content, without having to manually edit every link, you’ll need to run another search and replace plugin and search for the urls using this structure.

      • Jeremy says

        Good tip, ive been trying to work this out for a while now, didn’t even occur to me that the url would have been done like that. Hooray.

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.