![]() |
|
Guide How to Change a Website's Domain in CyberPanel (Files, WordPress, 301) - Printable Version +- AdminsForum (https://adminsforum.com) +-- Forum: Free & open-source control panels (https://adminsforum.com/Forum-free-open-source-control-panels) +--- Forum: CyberPanel (https://adminsforum.com/Forum-cyberpanel) +---- Forum: CyberPanel Guides & Tutorials (https://adminsforum.com/Forum-cyberpanel-guides-tutorials) +----- Forum: CyberPanel Websites & OpenLiteSpeed Guides (https://adminsforum.com/Forum-cyberpanel-websites-openlitespeed-guides) +----- Thread: Guide How to Change a Website's Domain in CyberPanel (Files, WordPress, 301) (/Thread-guide-how-to-change-a-website-s-domain-in-cyberpanel-files-wordpress-301) |
How to Change a Website's Domain in CyberPanel (Files, WordPress, 301) - JAY - 11-07-2026 How to Change a Website's Domain in CyberPanel: Files, WordPress and a 301 Redirect (Tested) CyberPanel has no "rename domain" button. Websites → Modify Website only changes the package, owner, email and PHP version. To move a site to a new domain you create a new website, copy the site over, update the old address inside the site, and send the old domain to the new one with a 301 redirect, so visitors and Google follow you. We did exactly that on CyberPanel 3.0.8 (Ubuntu 24.04, OpenLiteSpeed), moving a WordPress site from course.adminslab.com to a new domain. Below we use olddomain.com and newdomain.com. Replace them with yours. Before you start
Step 1: Create the new website Go to Websites → Create Website. Pick the package and owner, type the new domain, and choose the same PHP version the old site uses. Click Create Website. Because our DNS already pointed to the server, CyberPanel issued a Let's Encrypt certificate for the new domain during creation. We didn't have to do anything else for SSL. If yours didn't get one, see our SSL guide. Step 2: Copy the files (and fix the owner) CyberPanel gives every website its own Linux user. Find the new site's user: Code: ls -ld /home/newdomain.com/public_htmlCode: cpcyb5923Code: nogroupCopy the site: Code: rm -f /home/newdomain.com/public_html/index.html
rsync -a /home/olddomain.com/public_html/ /home/newdomain.com/public_html/Don't stop here. Code: rsync -aCode: public_htmlCode: new public_html before: drwxr-x--- cpcyb5923:nogroup
after rsync: drwxr-x--- cours5268:nogroup <- the OLD site's userCode: chown -R NEWUSER:NEWUSER /home/newdomain.com/public_html
chown NEWUSER:nogroup /home/newdomain.com/public_htmlCode: public_htmlCode: nogroupCode: NEWUSER:NEWUSERCode: ls -ldStep 3: The database If both sites are on the same server, the copied Code: wp-config.phpBut be careful: when you delete a website in CyberPanel, it also deletes every database attached to that website. We checked CyberPanel's own code ( Code: /usr/local/CyberCP/plogical/vhost.pyCode: wp-config.phpStep 4: Change the address inside WordPress WordPress stores its own address (and every link and image URL) in the database. Change them all with WP-CLI: Code: wp --allow-root --path=/home/newdomain.com/public_html search-replace https://olddomain.com https://newdomain.com --all-tables --skip-columns=guidCode: --skip-columns=guidCode: wp --allow-root --path=/home/newdomain.com/public_html cache flushCheck the result: Code: wp --allow-root --path=/home/newdomain.com/public_html option get homeCode: https://newdomain.comNot WordPress? Look for the old domain in your config files and change it by hand: Code: grep -rl "olddomain.com" /home/newdomain.com/public_html --include=*.php --include=.envStep 5: Check the new site Open Code: https://newdomain.comStep 6: Send the old domain to the new one (301) Keep the old website in CyberPanel and turn it into a redirect. Open Websites → olddomain.com → Config → Rewrite Rules, delete everything in the box, paste this and click Save Rewrite Rules: Code: RewriteEngine On
RewriteRule ^(.*)$ https://newdomain.com/$1 [R=301,L]This keeps the path, so old links land on the same page at the new address. We tested it: Code: https://olddomain.com/ -> 301 https://newdomain.com/
https://olddomain.com/sample-page/ -> 301 https://newdomain.com/sample-page/
https://olddomain.com/?p=1 -> 301 https://newdomain.com/?p=1
https://olddomain.com/wp-login.php -> 301 https://newdomain.com/wp-login.php
http://olddomain.com/ -> 301 https://newdomain.com/After the move
Questions or a step that didn't work for you? Reply below (hide your server IP first). |