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

Wie man WordPress ordnungsgemäß von einer Subdomain in eine Root-Domain verschiebt

Hinweis der Redaktion: Wir erhalten eine Provision für Partnerlinks auf WPBeginner. Die Provisionen haben keinen Einfluss auf die Meinung oder Bewertung unserer Redakteure. Erfahre mehr über Redaktioneller Prozess.

Möchten Sie eine WordPress-Website von einer Subdomain in eine Root-Domain umziehen?

Der Prozess ist recht einfach zu befolgen, und es gibt auch eine Möglichkeit, Ihre SEO-Rankings zu retten.

In diesem Artikel zeigen wir Ihnen, wie Sie WordPress ganz einfach von einer Subdomain in eine Root-Domain umziehen können, mit einer Schritt-für-Schritt-Anleitung.

Moving a WordPress site from subdomain to root domain

WordPress von der Subdomain zur Root-Domain übertragen

Eine Subdomain ist eine Erweiterung Ihres Stammdomainnamens. Zum Beispiel ist http://yourwebsite.example.com eine Subdomain von example.com. In diesem Fall ist example.com die Stammdomäne.

Suchmaschinen betrachten die Subdomain als eine völlig andere Website. Deshalb müssen Sie sicherstellen, dass Sie die Suchmaschinen nach dem Umzug ordnungsgemäß auf die Stammdomäne umleiten. Dies wird Ihnen helfen, die Suchergebnisse nach dem Umzug Ihrer Website beizubehalten.

Im Gegensatz zum Umzug einer WordPress-Site auf einen neuen Host oder einen neuen Domainnamen ist der Umzug einer Site auf die Root-Domain etwas einfacher.

Vor allem, weil beide in der Regel beim selben Webhosting-Unternehmen gehostet werden. Dadurch können Sie einige Schritte überspringen.

Schauen wir uns an, wie man eine WordPress-Site von einer Subdomain in die Root-Domain verschiebt.

Schritt 1. Erstellen Sie ein vollständiges Backup Ihrer Website

Sie sollten immer eine Backup-Lösung für automatische Backups auf Ihrer Website installiert haben. Es gibt viele WordPress-Backup-Plugins, die Sie verwenden können, um Ihre WordPress-Inhalte zu sichern.

Wenn Sie bereits ein Backup-Plugin installiert haben, dann können Sie diesen Schritt überspringen.

Dieser Schritt soll Sie daran erinnern, dass Sie, auch wenn Sie automatische Backups Ihrer Website haben, immer noch ein vollständiges Backup Ihrer Website erstellen müssen. Dazu gehören eine Datenbanksicherung sowie eine Sicherung aller WordPress-Dateien und -Ordner.

Sobald Sie eine vollständige Sicherung erstellt haben, sollten Sie diese an einem entfernten Ort oder auf Ihrem Computer speichern.

Schritt 2. Verschieben Ihrer WordPress-Dateien von der Subdomain in den Root-Ordner

Zunächst müssen Sie mit einem FTP-Client oder dem Dateimanager von cPanel eine Verbindung zu Ihrer Website herstellen. Sobald Sie verbunden sind, gehen Sie zu Ihrem Unterordner und laden Sie alle WordPress-Dateien auf Ihren Computer herunter.

Download WordPress files

Öffnen Sie als nächstes den Ordner public_html Ihrer Root-Domain. Je nachdem, wie Ihre WordPress-Hostingumgebung eingerichtet ist, kann dieser Ordner auch www oder nach Ihrem Domainnamen benannt sein.

Nun müssen Sie alle WordPress-Dateien, die Sie zuvor heruntergeladen haben, in das Stammverzeichnis hochladen.

Upload WordPress files to root domain

Schritt 3. Ändern der WordPress-URL- und Site-URL-Einstellungen

Sobald Sie die WordPress-Dateien verschoben haben, können Sie nicht mehr auf den WordPress-Verwaltungsbereich auf der Root-Domain zugreifen. Wenn Sie versuchen, sich auf der Root-Website anzumelden, werden Sie zurück zum Verwaltungsbereich der Subdomain-Website geleitet.

Um dies zu beheben, wechseln Sie zum FTP-Client und gehen Sie zum Stammverzeichnis Ihres Domainnamens. Als Nächstes müssen Sie die Datei wp-config.php bearbeiten und die folgenden Zeilen direkt vor der Zeile „That’s all, stop editing! Viel Spaß beim Bloggen“.

define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');

Vergessen Sie nicht, example.com durch Ihren eigenen Domänennamen zu ersetzen. Wenn Sie möchten, dass Ihre Stammwebsite www verwendet, müssen Sie die URLs mit dem Präfix www eingeben.

Speichern Sie Ihre Änderungen und laden Sie die Datei wp-config.php zurück auf Ihre Website.

Sie können nun den Verwaltungsbereich Ihrer WordPress-Website unter dem Root-Domainnamen aufrufen.

Schritt 4. URLs aktualisieren

Ihre WordPress-Site ist auf die Root-Domain umgezogen, aber in Ihrer WordPress-Datenbank gibt es Links, die auf die Subdomain verweisen.

Das sollten wir ändern.

Sie müssen das Go Live Update URLs-Plugin installieren und aktivieren. Weitere Einzelheiten finden Sie in unserer Schritt-für-Schritt-Anleitung zur Installation eines WordPress-Plugins.

Nach der Aktivierung müssen Sie die Seite Tools “ Go Live in Ihrem WordPress-Administrationsbereich aufrufen.

Select core tables to update

Oben auf der Seite können Sie die URLs in Ihren Beiträgen, Kommentaren, Optionen, Benutzerdaten, Begriffen und anderen Bereichen aktualisieren, indem Sie ein Häkchen in das entsprechende Kästchen setzen.

Scrollen Sie dann zum unteren Ende der Seite. Hier müssen Sie die URL Ihrer Subdomain neben der Option „Alte URL“ eingeben und Ihre Stammdomain als „Neue URL“ hinzufügen.

Enter old and new URL

Wenn Sie fertig sind, klicken Sie auf die Schaltfläche „Update Urls“, um fortzufahren.

Das Plugin wird nun alle URLs in Ihrer WordPress-Datenbank aktualisieren.

Schritt 5. Umleitung des gesamten Subdomain-Verkehrs auf die Root-Domain

Nachdem Sie nun die WordPress-Dateien verschoben haben, müssen Sie sicherstellen, dass der Datenverkehr Ihrer Subdomain auf den Root-Domainnamen umgeleitet wird.

Gehen Sie zu Ihrem Subdomain-Ordner und stellen Sie sicher, dass versteckte Dateien sichtbar gemacht werden.

In den Einstellungen Ihres FTP-Clients gibt es die Option, versteckte Dateien immer anzuzeigen. In FileZilla befindet sie sich unter der Option Server “ Anzeige versteckter Dateien erzwingen.

Show hidden files

Wenn Sie den cPanel File Manager verwenden, klicken Sie auf die Schaltfläche „Einstellungen“ in der oberen rechten Ecke des Bildschirms. Daraufhin wird das Einstellungs-Popup geöffnet. Wählen Sie „Versteckte Dateien anzeigen“ und klicken Sie dann auf die Schaltfläche „Speichern“.

Show hidden files in cPanel file manager

Wenn Ihr Subdomain-Ordner bereits eine .htaccess-Datei enthält, können Sie diese löschen und eine neue Datei erstellen. In der neuen .htaccess-Datei müssen Sie den folgenden Code kopieren und einfügen:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^yoursubdomain\.example\.com$ [NC]
RewriteRule ^(.*)$ "http://example.com/$1" [R=301,L]
</IfModule>

Vergessen Sie nicht, Ihre Subdomain durch Ihre tatsächliche Subdomain und example.com durch Ihren Domänennamen zu ersetzen.

Bitte beachten Sie, dass die RewriteRule-Zeile eine Nicht-WWW-URL verwendet. Wenn Sie www in Ihrer Root-Domain verwenden möchten, müssen Sie Ihre URL mit einem www-Präfix hinzufügen.

Speichern Sie Ihre Änderungen und laden Sie Ihre .htaccess-Datei auf den Server hoch.

Das war’s schon. Sie haben Ihre Website erfolgreich von der Subdomain zur Root-Domain verschoben. Sie können nun Ihre Website besuchen, um sie in Aktion zu sehen. Testen Sie Ihre Website, um sicherzustellen, dass alles einwandfrei funktioniert.

Wir hoffen, dieser Artikel hat Ihnen geholfen, Ihre Website von der Subdomain zur Root-Domain umzuziehen. Vielleicht interessieren Sie sich auch für unseren ultimativen WordPress-SEO-Leitfaden für Anfänger sowie für unsere Auswahl der besten 404-Weiterleitungs-Plugins für WordPress.

Wenn Ihnen dieser Artikel gefallen hat, dann abonnieren Sie bitte unseren YouTube-Kanal für WordPress-Videotutorials. Sie können uns auch auf Twitter und Facebook finden.

Offenlegung: Unsere Inhalte werden von unseren Lesern unterstützt. Das bedeutet, dass wir möglicherweise eine Provision verdienen, wenn Sie auf einige unserer Links klicken. Mehr dazu erfahren Sie unter Wie WPBeginner finanziert wird , warum das wichtig ist und wie Sie uns unterstützen können. Hier finden Sie unseren redaktionellen Prozess .

Das ultimative WordPress Toolkit

Erhalte KOSTENLOSEN Zugang zu unserem Toolkit - eine Sammlung von WordPress-bezogenen Produkten und Ressourcen, die jeder Profi haben sollte!

Reader Interactions

63 KommentareEine Antwort hinterlassen

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

    hello and thank you for this article
    i moved a website from subdomain to domain but the problem that i have is when i enter the subdomain url in the browser the website is being displayed but the url that is being displayed in the address bar is the subdomain , and when i click one of the links on the website then i am being redirected to main domain , please note there is nothing on the subdomain right now.
    i do have 301 redirect on the subdomain but something doesn’t seem to be working properly , any idea what could be causing this? any help or tip would be appreciated
    thank you in advance

    • WPBeginner Support says

      If you’ve already done the step to update your URLs, we would recommend checking your Settings>general page to ensure the URL was updated correctly there.

      Admin

  3. Jesse Dill says

    I am going through the steps and on step 3, I followed the php syntax but it caused some errors and I couldn’t get to any of the wordpress admin sites. I had to remove the pre tags and just use:

    define(‚WP_HOME‘,’http://example.com‘);
    define(‚WP_SITEURL‘,’http://example.com‘);

    After that it worked. Just in case anyone comes across the same issue as me.

  4. sarah says

    Hi, Step two doesn’t seem to work for me as CPanel won’t let me download the directory sub.example.com

    I can download individual files but not folders or directories. I have tried compressing to .zip but the .zip file is empty.

    Can you please advise? Many thanks

  5. Jessica says

    I see that Velvet Blues Update URLs plugin on wordpress.org is noted „This plugin hasn’t been tested with the latest 3 major releases of WordPress. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.“

    Do you recommend a different plugin now or to still use this one?

  6. Caleb Byers says

    Do you need to update anything in the databases after doing the steps in the article? Whenever moving a site I’ve seen people say that there are a few steps in the databases, but not in this article… Is there a reason why?
    Thanks.

  7. Del Abernethy says

    Worked a charm up until I tried to login to wp-admin. The site already had files (which I over-wrote) and users but now it won’t recognise the existing users. It does allow me to login using the username & password from the sub-domain so I’m assuming it is linked to the sub-domain database. Is it possible to link it to the existing original database?

    • WPBeginner Support says

      You would want to check the wp-config file for the database it is connected to for your site and you would be able to change that in your file. That would normally happen if you didn’t overwrite the existing file if you were trying to replace a site with the one on the subdomain.

      Admin

    • WPBeginner Support says

      It would depend on what references you are talking about. If you mean links in the articles then the velvet blues plugin updates those.

      Admin

    • WPBeginner Support says

      You would likely want to check with your hosting provider to ensure they don’t have a firewall and your SSL certificate is active as the most common reasons

      Admin

  8. Ben says

    Hey – do you reccomend also using Googles change of address tool, to tell it subdomain.primarydomain.com is now primarydomain.com ?

    thanks

    • WPBeginner Support says

      If you want you can also use that tool, the redirects would normally resolve this for you.

      Admin

  9. Sara says

    Hi,
    I followed your steps up until the end of step 3, where I have edited the wp-config.php file
    I then go to the wp-admin. I enter my details and it just goes back to the same login. It’s not allowing me to login to the wordpress backend.
    It’s like it’s redirecting me.
    Are you able to help?
    I’d really appreciate it.
    Thanks,
    Sara

  10. Sofia says

    Hello, I did everything and it worked! But now I’m wondering, how do I keep my subdomain as a „staging“ website, so that I can change things and not affect the one on the domain. I’d have to make a new database (using a backup) right?
    How to assure I don’t do anything wrong?

  11. Oliver says

    In my subdomain folder, I have 2 .htaccess files. One is in subdomains/example, the other is in subdomains/example/web. The latter is next to all the other wordpress files. Which one should I delete and replace with the code in step 5?

  12. Aldo Salim says

    Hi, thank you so much for the great help.

    However, i do not want to keep the old sub-directory folder. Will it be okay to delete the sub-directory folder?

  13. Joshua Orizu says

    I am building a websites and the domain name is displaying site.comp50 instead of site.com how do i fix this

    • WPBeginner Support says

      You may want to check with your hosting provider to ensure the correct domain is attached to where your site is and then you would be able to update the url in your Settings>General area

      Admin

  14. Jeremy says

    What happens to the blog posts on the root domain during a migration?

    I currently built a redesigned site on a subdomain, Sandbox.WebsiteName.com, and want to migrate it over to the the root domain. However, I want to keep the blog posts.

    i’m worried about the seo. Do the blog post from the root domain get overwritten? If not how would i access them to redirect them?

    Thanks,

  15. Madison says

    Hi,

    Would this method work if I wanted to move a subdomain, which a friend uses, ie, xxx.example.com, over to their new account so it can be its own website like xxx.com?

    If not, is there anything that would work at all or would they just have to start over, thus losing all the comments, page views, etc?

  16. Rui says

    Hi,
    This tutorial is great, but didn’t work for me. I don’t know why.

    I can access to admin area, in homepage the images are not shown and when i tried to access posts and products says „Not Found
    The requested URL /shop/index.php was not found on this server.“

    I would like some help if possible.
    Thank you a lot

    • Canonical Bear says

      Hi,
      We had the same problem (my team and I). Only the Home Page would open, and all other pages were broken.
      You need to update the permalinks. Go to Dashboard ->Settings -> Permalinks. Here, don’t make any changes, just click on „Save Changes“.
      It re-apply settings with the current directory as root.
      All the best.

  17. Milan says

    Hello WP Team,

    just one quick question… what is the difference between this procedure and clone website from cpanel installatron (godaddy). Can I use clone for same purpose? Do I need to made some additional changes after cloning. It’s looks much easier to do this with clone option.

    Thanks for good work!

  18. Melind says

    This worked like a charm! The part that takes the longest is uploading and downloading the files. Thank you!

  19. smv says

    This didn’t work for me at all. Step 4, using the Velvet Blues plug-in to update the URLs, didn’t update most of them. There were still loads of references to the old site. I had to re-do everything, but I used the duplicator plug-in, which worked well.

  20. Gábor Sztárcsevics says

    Hi!

    Is this modification will change the records in the database, which is used for my wordpress on the subdomain.example.com?

    Shouldn’t I create a new database for the migrated wordpress?

    Thank you!

    • WPBeginner Support says

      Hi Gábor Sztárcsevics,

      Since you are moving from subdomain to root domain on the same hosting environment, your old database would work just fine after you update URLs as shown in the tutorial.

      However, if you would like to create a new database, then you can do that as well. You will then need to export your data from the old database to the new one and update URLs.

      Admin

  21. Shravan says

    RewriteCond %{HTTP_HOST} ^yoursubdomain\.example\.com$

    in this code, do i need to remove those 2 backward slash’s

  22. Denise says

    I don’t see where you remove the old wordpress files. Are they automatically replaced when you upload the subdomain files to the root?
    Thank you.

  23. Charlotte Jones says

    I tried this and got a HTTP 500 error. Luckily I backed everything up, but I don’t understand. All the files are there in public_html and I changed the wp-config file to point to the root domain.

  24. Jon says

    Very good thank you. Went like a dream apart from an error I made by amending the old subdomain .htaccess file instead of the new one in the root. Your advice was excellent tho.

  25. Juan F. says

    Hi guys,

    After doing all the steps, if I want to save a page I get an error and automatically redirects me to the post list, could you help me please?

    Thanks in advance.

    • Anita says

      Hello!
      If I make the site in the exemple.com/Wordpress folder, do I have to move it to the example.com folder or can I just redirect it, how does that work?
      /Anita

  26. Ousman Faal says

    This was definitely useful. I was just about to change a demo site on a sub domain to a root domain.
    You guys are live savers.

Eine Antwort hinterlassen

Danke, dass du einen Kommentar hinterlassen möchtest. Bitte beachte, dass alle Kommentare nach unseren kommentarpolitik moderiert werden und deine E-Mail-Adresse NICHT veröffentlicht wird. Bitte verwende KEINE Schlüsselwörter im Namensfeld. Lass uns ein persönliches und sinnvolles Gespräch führen.