Moving a website: domain and hosting
Domain and hosting
Every website has two parts that can belong to different companies:
- the domain, the name you type in the browser, registered at a registrar;
- the site, its pages, pictures, scripts and database, stored at a hosting provider.
One company can sell both, but it does not have to. Before a move find out for each part who has it, under whose name, and how you get access. The practical manuals for the two shared hosts used in the example: Beget and DreamHost. Tools used here: curl, SSH, git.
Move the domain
A domain is registered to a person or a company. Make sure it is yours. The registrar and the status of a domain are public at lookup.icann.org and in the output of whois:
whois example.com
[Querying whois.iana.org:43 'example.com'] [whois.iana.org] % IANA WHOIS server % for more information on IANA, visit http://www.iana.org % This query returned 1 object domain: EXAMPLE.COM organisation: Internet Assigned Numbers Authority created: 1992-01-01 source: IANA
example.com is a reserved name, so the answer stops at IANA and has no registrar. On a real domain look for Registrar:, Registrar WHOIS Server:, Domain Status: and Registry Expiry Date:. The contact email should be one you read, because the registrar sends the codes for a move there.
Three DNS questions answer where the site and its mail live now. NS names the servers that answer for the domain, A the address of the site, MX the mail servers:
dig +short NS example.com
ns2.dreamhost.com. ns1.dreamhost.com. ns3.dreamhost.com.
dig +short A example.com
203.0.113.10
dig +short MX example.com
The MX query prints nothing: this domain receives no mail, so there is no mail record to keep.
Write the answers down. After the move NS and A must point to the new host, and MX must still point to a working mail server. The meaning of the records: DNS.
To move a domain such as .com to another registrar you need its transfer code (auth code, EPP code) from the old registrar, and the domain must be unlocked. Usually it cannot move within 60 days after it was registered or last moved. Country domains have their own rules; ask the registrar. Also note how much the yearly renewal costs now and at the new registrar. A move of the hosting alone does not need a transfer code: the domain stays at its registrar and only its DNS records change.
Lower the TTL
DNS answers are cached for the time to live, TTL, of the record. A record with a one-hour TTL keeps sending visitors to the old server for an hour after the switch. Lower the TTL a day before the move, at the DNS provider that holds the records now. A value of 300 seconds is enough:
dig example.com A
example.com. 59 IN A 203.0.113.10
The TTL is the number in the second column of the answer. Set it to 300 for the A, AAAA and CNAME records of the site. Wait at least the old TTL before you switch, so the old value leaves every cache. On Beget the records are in the control panel; the panel of the DNS provider does the same when the domain uses its nameservers.
Copy the files
For the files you need access to the hosting: a control panel, or FTP or SFTP with a host, user name and password, or SSH. Copy over SSH, which keeps the timestamps and can set the modes in the same pass:
rsync -av --chmod=D755,F644 ~/site/ dh_user@<server>.dreamhost.com:~/example.com/
-a keeps the times, the links and the permissions. --chmod=D755,F644 then overrides the permission part in the copy: every folder becomes 755, every file 644. Without it the modes of the local files travel as they are. A checkout often has folders 700 and files 600, and Apache, which runs as another user, cannot read them. This is exactly what went wrong in problem 3 of the example. After the upload, both checks must print 0:
find ~/example.com -type d ! -perm 755 | wc -l
find ~/example.com -type f ! -perm 644 | wc -l
A deploy that copies only the files tracked by git skips the images and other ignored files. List the ignored files first, then copy that list:
cd ~/site
git ls-files --others --ignored --exclude-standard > /tmp/untracked.txt
wc -l /tmp/untracked.txt
rsync -av --chmod=D755,F644 --files-from=/tmp/untracked.txt ./ dh_user@<server>.dreamhost.com:~/example.com/
Check that every image answers 200 on the new host; a missing picture is a broken page that no HTML test sees. How to keep such a list in the repository: Git-ignored images: a committed list file.
Copy the database
A site with MySQL or MariaDB needs its data too. Export it on the old host in one transaction, with routines and triggers:
mysqldump --single-transaction --routines --triggers -u user -p example > ~/backups/example-$(date +%F).sql
--single-transaction takes a consistent snapshot without locking the tables of a busy site. --routines and --triggers keep stored procedures and triggers, which a plain dump drops. With -p it asks Enter password: and prints nothing more on success. Copy the file to the new host:
scp ~/backups/example-2026-11-07.sql dh_user@<server>.dreamhost.com:~/backups/
Create the database and its user in the panel of the new host, then import the file into it:
mysql -u user -p example < ~/backups/example-2026-11-07.sql
With -p it asks Enter password: and prints nothing more on success.
Count the tables on both sides; the numbers must match:
mysql -u user -p -N -e "SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = 'example';"
The commands are the same on MySQL and MariaDB. A database with a different name or a different user on the new host needs the dump edited or imported under the new name; the panel shows both.
Test before DNS
Do not change DNS first and debug afterwards. The new server answers for the domain as soon as its web server is configured, even while public DNS still points to the old one. Force the connection to the new address with --resolve:
curl -sS --resolve example.com:443:203.0.113.10 -o /dev/null -w "%{http_code} %{remote_ip}\n" https://example.com/
200 203.0.113.10
--resolve example.com:443:203.0.113.10 connects to 203.0.113.10 but sends example.com in the Host header and in the TLS handshake, so the certificate and every virtual host match the real name. %{remote_ip} in the output proves which server answered. Test the home page and a few inner pages, http and https, and one address that must answer 404.
A browser needs an /etc/hosts line instead. Add it with an editor as root and remove it after the test:
sudo vi /etc/hosts
203.0.113.10 example.com www.example.com
Now the ordinary address in the browser opens the new server. Check the certificate, the https redirect and a form that writes to the database. Remove the line when done, or the browser keeps seeing the new server after a mistake.
Switch the DNS
When the new site answers correctly, change the nameservers at the registrar, or the A records at the DNS provider, to the new host. If the domain stays at the same registrar and only the hosting changes, the usual change is one A record. If the whole DNS moves, the registrar gets the new nameservers, for example the four of Beget or the three of DreamHost.
Watch the change from a public resolver, not from the server that made it:
dig +short NS example.com
ns2.dreamhost.com. ns1.dreamhost.com. ns3.dreamhost.com.
dig +short A example.com @8.8.8.8
203.0.113.10
curl -sS -o /dev/null -w "%{http_code} %{remote_ip}\n" https://example.com/
200 203.0.113.10
The address in %{remote_ip} must be the new server. Keep the old hosting paid and running for a week: some resolvers and browsers cache the old address for the old TTL, and a rollback is then one DNS change away.
Checklist
| Task | Command or check |
|---|---|
| Look the domain up | whois example.com, lookup.icann.org |
| Write down the current DNS | dig +short NS example.com, dig +short A example.com, dig +short MX example.com |
| Lower the TTL a day before | dig example.com A, then set 300 at the DNS provider |
| Get the transfer code and unlock the domain | only when the registrar changes |
| Copy the files with safe modes | rsync -av --chmod=D755,F644 ~/site/ user@host:~/example.com/ |
| Copy the untracked files | git ls-files --others --ignored --exclude-standard, then rsync the list |
| Export and import the database | mysqldump --single-transaction --routines --triggers, then mysql ... < dump.sql |
| Test the new server before DNS | curl --resolve example.com:443:<new-ip> https://example.com/ |
| Switch the DNS | nameservers at the registrar, or the A record at the DNS provider |
| Check the new address answers | dig +short A example.com @8.8.8.8, curl -w "%{remote_ip}" |
| Check images and inner pages | curl -o /dev/null -w "%{http_code}" for each |
| Find files that a rule for pages redirects | 301 on image and script paths in the access log: awk '$9 == 301 && $7 ~ /\.(jpe?g|png|webp|gif|svg|js|css)$/ {print $7}' ~/logs/example.com/https/access.log | sort | uniq -c (problem 6) |
| Upload into the document root, not into a subfolder | source with a trailing slash: rsync -av ~/site/ ..., then the dry run -n (problem 7) |
| Turn off folder listings | Options -Indexes; a folder without an index page answers 403 (problem 8) |
| Remove backups and archives from the host | compare the host with git ls-files, review the list, delete (problem 9) |
| Stop the error log from growing | grep -c 'Creation of dynamic property', then declare the properties (problem 10) |
How to choose the new one: Which hosting to choose. The rules that often break during a move: Creating rules in .htaccess.
Example: from Beget to DreamHost
This is a real move, with the names changed: the domain is example.com, the Beget login is user with the home folder /home/u/user, the DreamHost login is dh_user and the server is <server>.dreamhost.com. The site is a hand-written PHP site without a database. Ten problems took most of the time; each is below as symptom, the command that shows it, the output and the fix.
Each problem ends with a box, Check if you have this problem, with commands to run on your own hosting and what their output means. The outputs in the boxes come from the moved site and from the Beget-like and DreamHost-like Docker images, with the names changed in the same way.
| Problem | Symptom | Cause |
|---|---|---|
| 1 | 500 on every request | php_flag without mod_php |
| 2 | every URL redirects to itself | https rule tests only the proxy header |
| 3 | about 90 pages answer 404 or 403 | folders 700 and files 600 |
| 4 | old URLs answer 404 on the new host | stale copies on the old host, not in the repository |
| 5 | images are missing | a git-based upload skips ignored files |
| 6 | images and scripts in one folder answer 301 | a PATH_INFO rule also matches a folder named .php |
| 7 | new pages answer 404 after every upload | the upload went into a subfolder |
| 8 | folders without an index page list their files | directory indexing is on by default |
| 9 | backups and archives from the work folder are public | the whole work folder was uploaded |
| 10 | the error log grew to 230 MB a day | dynamic property deprecations on every request |
Problem 1: 500 on every request
Symptom. The first request the new server logged already answered 500, the home page included. The built-in Apache page said the server encountered an internal error. The response headers:
curl -sS -D - -o /dev/null https://example.com/
HTTP/2 500 content-length: 533 content-type: text/html; charset=iso-8859-1 server: Apache
Command that shows it. The error log names the file and the directive:
tail -n 1 ~/logs/example.com/https/error.log
[Fri Nov 06 23:29:54 2026] [example.com] [alert] [client 203.0.113.7:37118] [pid 3064457] config.c(2045): /home/user/example.com/.htaccess: Invalid command 'php_flag', perhaps misspelled or defined by a module not included in the server configuration
Why. Beget runs PHP as mod_php, where php_flag and php_value work. DreamHost runs PHP as FastCGI and loads no mod_php, so Apache does not know the words: Why php_flag answers 500. The full diagnosis is in 500 on every page after a host move.
Fix. Back up the file first:
mkdir -p ~/backups
cp -p .htaccess ~/backups/example.com.htaccess.$(date +%Y%m%d-%H%M%S)
Wrap the twelve lines in IfModule, so a host without mod_php skips them:
vi .htaccess
<IfModule mod_php.c> php_flag display_errors off php_flag log_errors on # the other ten lines stay inside this block </IfModule>
Then put the same settings in the file DreamHost reads, and restart the PHP worker:
vi ~/.php/8.5/phprc
display_errors = Off log_errors = On error_reporting = -1
pkill -x php85.cgi
The guards in general: IfModule. The check that tells mod_php from FastCGI: Which server do you have.
The same check, run after the move, found the same lines later in six subfolder .htaccess files of the PHP demos. Only those folders answered 500; the rest of the site worked, and the [alert] line above names the file. Each folder needs the IfModule guard and a .user.ini of its own; on the host user_ini.filename = .user.ini and user_ini.cache_ttl = 300, so a change shows after up to 5 minutes. Not ~/.php/8.5/phprc: that file applies to the whole account, and these are settings for one folder.
vi demo/.user.ini
; PHP FastCGI reads this file per folder; mod_php reads .htaccess session.use_cookies = 1 session.use_only_cookies = 1 session.use_trans_sid = 0 session.use_strict_mode = 1 session.cache_limiter = nocache session.cookie_samesite = "Lax" session.name = AOSESSID session.save_path = "./tmp" session.cookie_path = "/" session.cookie_lifetime = 0 session.cookie_httponly = 1 session.cookie_secure = 1
Check if you have this problem
Find the PHP directives in every .htaccess of the site. Run it on the server over SSH, or in a local copy of the document root:
grep -rn --include=.htaccess -E '^\s*php_(flag|value|admin_flag|admin_value)\s' ~/example.com
Then ask the server how it runs PHP. Put a probe in the document root, request it and delete it:
printf '<?php echo php_sapi_name(), "\n";' > ~/example.com/sapi-check.php
curl -sS https://example.com/sapi-check.php
rm ~/example.com/sapi-check.php
You have it if grep prints lines and the probe prints anything but apache2handler, for example cgi-fcgi (FastCGI, as on DreamHost):
/home/user/example.com/demo/.htaccess:3:php_flag session.use_cookies on /home/user/example.com/demo/.htaccess:4:php_flag session.use_only_cookies on
cgi-fcgi
The folder of each printed file, and every folder below it, then answers 500. A line inside an <IfModule mod_php.c> block is skipped safely, so look at each file grep names. You do not have it if grep prints nothing, or if the probe prints apache2handler (mod_php, as on Beget).
Problem 2: every URL redirected to itself
Symptom. With the 500 gone, every address answered 301 and the target was the address itself. A single request:
curl -sS -o /dev/null -w "%{http_code} %{redirect_url}\n" https://example.com/
301 https://example.com/
Command that shows it. Following the redirect shows the loop:
curl -sS -L -o /dev/null https://example.com/
curl: (47) Maximum (50) redirects followed
Why. The old https rule checked only the header that the Beget front server sends:
RewriteCond %{HTTP:X-Forwarded-Proto} !https RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
DreamHost ends TLS in Apache and sends no such header, so "not https" was true for every request, https ones included.
Fix. Add the condition on the TLS state Apache itself sees:
vi .htaccess
RewriteCond %{HTTPS} off RewriteCond %{HTTP:X-Forwarded-Proto} !https RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
On DreamHost %{HTTPS} is on for https, and the first condition stops the rule. Behind the old proxy %{HTTPS} is always off, and the header decides. Browsers cache 301s: after such a loop, test in a private window. The whole story is in Move to DreamHost: the loop; how to write the rule for both kinds of host: Redirect 301 or the pair.
Check if you have this problem
Ask for the home page over https, without following redirects:
curl -sS -o /dev/null -w "%{http_code} %{redirect_url}\n" https://example.com/
You have it if the answer is a 301 to the same address:
301 https://example.com/
Following the redirects confirms the loop:
curl -sS -L --max-redirs 5 -o /dev/null -w "%{http_code}\n" https://example.com/
curl: (47) Maximum (5) redirects followed 301
You do not have it if the first command prints 200, or a 301 to another address that then answers 200.
Problem 3: about 90 pages answered 404 or 403
Symptom. Pages that worked on Beget answered 403 Forbidden or 404 Not Found on DreamHost. The files were there and the paths were right.
Command that shows it. Compare the modes of a folder and its child:
stat -c '%a %U:%G %n' dev/python dev/python/files
755 dh_user:pg000000 dev/python 700 dh_user:pg000000 dev/python/files
Why. 69 folders in the local checkout had mode 700 and about 450 files had 600 or 700. rsync copied those modes, and so does a zip archive that is unpacked on the server. On the new host Apache, which runs as another user, could not enter the folders or read the files.
Fix. Save the old modes, then open folders and files on the server:
find ~/example.com -printf '%m %p\n' > ~/backups/example.com.modes.$(date +%Y%m%d-%H%M%S)
find ~/example.com -type d -exec chmod 755 {} +
find ~/example.com -type f -exec chmod 644 {} +
Fix the local checkout the same way, or the next upload brings the modes back. From then on copy with rsync --chmod=D755,F644, as in Copy the files. The DreamHost side: SSH and file modes; a container that reproduces the 403: test 5.
Check if you have this problem
On the server, list the folders that other users cannot enter and the files they cannot read. Apache usually runs as a different user from the account that owns the files. PHP session files (sess_*) and logs are closed on purpose, so the second command leaves them out:
find ~/example.com -type d ! -perm -o=x
find ~/example.com -type f ! -perm -o=r ! -name 'sess_*' ! -name '*.log'
You have it if either command prints a path. Every folder and file it prints answers 403:
/home/user/example.com/closed /home/user/example.com/notes.html
You do not have it if both commands print nothing.
Problem 4: old URLs answered 200 on Beget, 404 on DreamHost
Symptom. Some addresses that still worked on the old host answered 404 on the new one. The old addresses were not in the repository at all.
Command that shows it. The old site had top-level folders /centos/, /rocky/, /ubuntu/ and /debian/. Their pages had moved to /linux/... in the repository, but the old host kept answering 200 for the old paths, because uploads never delete server files. The new host had only the repository. Its access log showed the 404:
grep '"GET /centos/network/firewall.php ' ~/logs/example.com/https/access.log
198.51.100.23 - - [07/Nov/2026:00:34:30 -0800] "GET /centos/network/firewall.php HTTP/2.0" 404 5665 "https://www.example.com/" "Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Mobile/15E148 Safari/604.1"
Why. The pages were stale copies on the old host, not pages in the repository. The new host had nothing at the old paths.
Fix. Before a move, list what the old host serves that the repository lacks. A sitemap is a good start:
curl -sS https://example.com/sitemap.xml | grep -o "<loc>[^<]*" | cut -c 6- > /tmp/old-urls.txt
wc -l /tmp/old-urls.txt
5523
Check the list against the new host after the upload. Add the pairs after every exact rule for those folders, so a folder and its pages go to one new tree:
vi .htaccess
RewriteCond %{REQUEST_URI} ^/(centos|rocky|ubuntu|debian)/?$ RewriteRule ^ %{ENV:SCHEME}://%{HTTP_HOST}/linux/%1/ [R=301,L] RewriteCond %{REQUEST_URI} ^/(centos|rocky|ubuntu|debian)/(.*)$ RewriteRule ^ %{ENV:SCHEME}://%{HTTP_HOST}/linux/%1/%2 [R=301,L]
Afterwards one old address makes one hop to the new tree:
curl -sS -o /dev/null -w "%{http_code} %{redirect_url}\n" https://example.com/centos/network/firewall.php
301 https://example.com/linux/centos/network/firewall.php
The order of rules and the one-hop rule: Order of rules. SCHEME is set once at the top of the file, with an E=SCHEME:https rule; the full block is in the pair. A redirect for a static file that still exists on disk does not run on Beget: nginx serves the file first, as nginx in front of Apache explains. When a 301 keeps a page that must disappear, use [R=404,L] instead: Safe rules, guards and rollback.
Check if you have this problem
Before the old host is closed, compare the pages it serves with the pages in your repository. Run these on your computer, in the folder of the checkout that holds the document root:
ssh user@old-host 'cd ~/example.com && find . -type f -name "*.php" -printf "%P\n"' | LC_ALL=C sort > /tmp/host-pages.txt
git ls-files '*.php' | LC_ALL=C sort > /tmp/repo-pages.txt
LC_ALL=C comm -23 /tmp/host-pages.txt /tmp/repo-pages.txt
You have it if comm prints files. The old host serves them, and after the move each one answers 404 unless you copy it or redirect it:
dev/php/htaccess.php edu/nuclear_power/nuclear_power.php web/hosting.php
Both lists need LC_ALL=C: comm expects them sorted the same way, and two locales sort differently. After the move, the most frequent 404s in the access log show what is still missing:
awk '$9 == 404 {print $7}' ~/logs/example.com/https/access.log | sort | uniq -c | sort -rn | head
10 /linux/rocky/network/netstat.php 7 /.well-known/traffic-advice 6 /linux/rocky/network/hostname.php
You do not have it if comm prints nothing.
Problem 5: images were missing
Symptom. The pages loaded, but pictures answered 404. The images worked in the local checkout.
Command that shows it. Count the images git tracks and the images it ignores:
git ls-files | grep -c -i -E '\.(jpe?g|png|webp|gif)$'
242
git ls-files --others --ignored --exclude-standard | grep -c -i -E '\.(jpe?g|png|webp|gif)$'
19475
Why. The image files are ignored by git. A deploy that copies only tracked files skipped them, while the old host still had the copies uploaded years earlier over FTP.
Fix. Copy the ignored files separately with the same mode override, then check each one on the new host:
rsync -av --chmod=D755,F644 ~/site/img/ dh_user@<server>.dreamhost.com:~/example.com/img/
curl -sS -o /dev/null -w "%{http_code} %{size_download}\n" https://example.com/img/cover.jpg
200 180023
A list of ignored files kept in the repository makes the next move repeatable: Git-ignored images: a committed list file.
Check if you have this problem
In the folder of your checkout that holds the document root, request every image git ignores from the live site, and print the ones that do not answer 200. head -n 200 keeps the first run short; remove it to check them all:
git ls-files --others --ignored --exclude-standard | grep -i -E '\.(jpe?g|png|webp|gif|svg)$' | head -n 200 | while IFS= read -r f; do printf '%s %s\n' "$(curl -s -o /dev/null -w '%{http_code}' "https://example.com/$f")" "$f"; done | grep -v '^200'
You have it if lines with 404 appear. Those images are in your checkout but not on the host:
404 aa_img/120_600_MINI-black.gif 404 aa_img/about-finland.jpg 404 aa_img/admitad/admitad_book24_600x300.jpg
You do not have it if nothing is printed. 000 instead of a status means that no answer came: a shared host may refuse a fast run of requests for a few minutes. Wait, then run again with a smaller head -n.
Problem 6: images and scripts in one folder answered 301
Symptom. A few pages showed broken card images, and their scripts did not run. The files were on the server with the right modes, and the error log said nothing about them.
Command that shows it. Ask for one of the files:
curl -sS -o /dev/null -D - https://example.com/.php/img/cards/airport.jpg | grep -i -E '^(HTTP|location|server)'
HTTP/2 301 location: https://example.com/.php server: Apache
Then list every 301 below that folder in the access log:
awk '$9 == 301 && $7 ~ /\/\.php\// {print $7}' ~/logs/example.com/https/access.log | sort | uniq -c
3 /ru/.php/img/cards/actress-800x600.jpg 1 /.php/scripts/top10_script3.js 1 /.php/scripts/top10_script2.js 1 /ao/.php/scripts/top10_script2.js
Why. The site keeps its PHP classes, and the images and scripts they use, in folders named .php. The rule that redirects a page with PATH_INFO used the pattern ^(.+\.php)/.+$, which matches those folders too. On Beget, nginx served the files before Apache read the rule, so the mistake never showed. On DreamHost, Apache serves them.
Fix. Require a file name before .php:
RewriteCond %{REQUEST_URI} ^(.*[^/]\.php)/.+$
The full rule is in DreamHost: static files go through .htaccess, and the same request against both kinds of server, before and after the fix, is test 6 of the Docker test plan.
Check if you have this problem
On the new host, list the static files that answered 301:
awk '$9 == 301 && $7 ~ /\.(jpe?g|png|webp|gif|svg|js|css)$/ {print $7}' ~/logs/example.com/https/access.log | sort | uniq -c | sort -rn | head
5 /python/img/00114.webp 3 /.php/img/cards/actress-800x600.jpg 3 /databases/db_img/mysql_00100.jpg
A moved image may redirect on purpose. See where each redirect goes:
curl -sS -o /dev/null -w "%{http_code} %{content_type} %{redirect_url}\n" https://example.com/python/img/00114.webp
301 text/html; charset=iso-8859-1 https://example.com/dev/python/img/00114.webp
curl -sS -o /dev/null -w "%{http_code} %{content_type} %{redirect_url}\n" https://example.com/.php/img/cards/actress-800x600.jpg
301 text/html; charset=iso-8859-1 https://example.com/.php
You have it if the target is a folder or a page instead of a file of the same type, as in the second answer. The first one is a moved image and is fine.
The log only shows files that someone asked for. To test every file in a folder before visitors find the problem, request them directly from the folder of your checkout that holds the document root. Change the -path test to the folders your rules could match:
find . -type f -path '*.php/*' \( -iname '*.jpg' -o -iname '*.png' -o -iname '*.webp' -o -iname '*.js' -o -iname '*.css' \) | head -n 50 | while IFS= read -r f; do printf '%s %s\n' "$(curl -s -o /dev/null -w '%{http_code}' "https://example.com/${f#./}")" "${f#./}"; done | grep -v '^200'
301 .php/php_includes/topmenu.js 301 .php/img/ads/ads_banner_fin2.PNG 301 .php/php_includes/scripts/rb_script.js
You do not have it if nothing is printed. 000 instead of a status means that no answer came: a shared host may refuse a fast run of requests for a few minutes. Wait, then run again with a smaller head -n.
Problem 7: new pages answered 404 after every upload
Symptom. New pages answered 404 after every upload, while the files were in the local checkout. The pages of the first upload kept working.
Command that shows it. The upload had no trailing slash on the source:
rsync -av ~/site dh_user@<server>.dreamhost.com:~/example.com/
sending incremental file list site/ site/!!!_notes.txt site/.htaccess site/3108a3f8a0abf63e94ac5c71960b0c741b3e71d2.txt
Without the slash rsync creates ~/example.com/site/ and copies the files into it. Every upload after the first one landed in that folder. The docroot got none of the new pages: 77 of them answered 404. The root .htaccess on the host also stayed at the version of the first upload, so later rule fixes never reached the site. And https://example.com/site/ served a public second copy of the site:
curl -s -o /dev/null -w '%{http_code}\n' https://example.com/site/
200
Why. rsync treats a source without the trailing slash as a folder to copy, not as the folder contents. The destination then holds a folder named site with the whole site inside.
Fix. Add the slash to the source and copy the contents of the folder:
rsync -av ~/site/ dh_user@<server>.dreamhost.com:~/example.com/
Run it with -n first and read the first paths of the list. They must start with ./, not with site/:
rsync -avn ~/site/ dh_user@<server>.dreamhost.com:~/example.com/ | head -n 5
sending incremental file list ./ PHP_errors copy(1).log PHP_errors copy(2).log PHP_errors copy.log
The first path is ./, not site/; the files it lists are leftovers that would go up too, see problem 9.
Then look at the stray folder on the server and delete it:
ssh dh_user@<server>.dreamhost.com 'ls ~/example.com/site | head'
ssh dh_user@<server>.dreamhost.com 'rm -r ~/example.com/site'
An upload script should refuse a target that has no index.php. The trailing slash in general is in Moving a site: copy the files; the same section on this page is Copy the files.
Check if you have this problem
Ask for the folder your upload would create:
curl -s -o /dev/null -w '%{http_code}\n' https://example.com/site/
404
You have it if the answer is 200: the folder is public. You do not have it if the answer is 404, as here today.
Over SSH, check whether the docroot holds a folder named like your local source folder, with an index.php inside:
ssh dh_user@<server>.dreamhost.com 'ls -d ~/example.com/site ~/example.com/site/index.php'
ls: cannot access '/home/dh_user/example.com/site': No such file or directory ls: cannot access '/home/dh_user/example.com/site/index.php': No such file or directory
A No such file line for both means you do not have it. A path and a file mean the upload landed in the subfolder.
Compare the root .htaccess on the host with yours:
ssh dh_user@<server>.dreamhost.com 'cat ~/example.com/.htaccess' | diff -q - ~/site/.htaccess && echo same
same
Files - and ~/site/.htaccess differ means the uploads do not reach the docroot, or the file is not uploaded yet.
The dry run with the first paths is the last check:
rsync -avn ~/site/ dh_user@<server>.dreamhost.com:~/example.com/ | head -n 5
sending incremental file list ./ PHP_errors copy(1).log PHP_errors copy(2).log PHP_errors copy.log
If the list starts with site/, the source has no trailing slash and the upload goes into the subfolder again.
Problem 8: folders without an index page listed their files
Symptom. A folder address such as https://example.com/img/ showed a list of every file in it.
Command that shows it. Ask for a folder that has no index.php or index.html:
curl -s https://example.com/img/ | grep -c 'Index of'
2
Why. On DreamHost, Apache lists the files of a folder that has no index page: directory indexing is on by default.
Fix. Turn the listing off in the root .htaccess:
vi .htaccess
# No file list for a folder without an index page. Options -Indexes
After it the same folders answer 403, and a folder with index.php still loads:
curl -s -o /dev/null -w '%{http_code}\n' https://example.com/img/
403
Check if you have this problem
Find folders without an index page, on the server or in your checkout:
find . -type d ! -path '*/.git*' | while IFS= read -r d; do [ -e "$d/index.php" ] || [ -e "$d/index.html" ] || echo "$d"; done | head -n 20
./code ./gcc ./repository ./images ./.php
Request a few of them:
curl -s https://example.com/img/ | grep -c 'Index of'
0
curl -s -o /dev/null -w '%{http_code}\n' https://example.com/img/
403
curl -s -o /dev/null -w '%{http_code}\n' https://example.com/.php/img/
403
You have it if grep prints a number above 0, or the status is 200. You do not have it if grep prints 0 and the status is 403: today /img/ and /.php/img/ answer 403.
000 instead of a status means that no answer came: a shared host may refuse a fast run of requests for a few minutes. Wait, then run again.
Problem 9: backups and archives from the work folder were public
Symptom. A backup or an archive answered 200 at a public address. Older uploads copied the whole work folder, so the docroot also held files that are not part of the site.
Command that shows it. Ask for a backup of the home page:
curl -s -o /dev/null -w '%{http_code}\n' https://example.com/index.php.bak
200
Why. A .bak copy of a PHP file is not run by PHP: Apache serves it as text, so index.php.bak shows the source of the home page. On the host the upload script's stricter list left 1,496 files out of the deploy list: 3 archives (one a zip of the PHP folder, 87 MB, at the site root), 89 backups (index.php.bak, 27 sitemap backups, copies), 328 old logs, 467 files in tool folders (test reports, caches), 18 draft pages, plus the data files and databases the site writes itself and that must stay. After the cleanup the same request answers 404.
Fix. Upload a list, not the folder. Start with the files git tracks, add the git-ignored images by extension, and filter out drafts and junk folders:
cd ~/site
git ls-files > /tmp/deploy.txt
git ls-files --others --ignored --exclude-standard | grep -i -E '\.(jpe?g|png|webp|gif|svg|ico)$' >> /tmp/deploy.txt
grep -v -E '^(drafts/|tools/|tmp/|.*\.(bak|log|zip|orig|sql)$)' /tmp/deploy.txt | LC_ALL=C sort > /tmp/deploy.clean.txt
rsync -av --chmod=D755,F644 --files-from=/tmp/deploy.clean.txt ./ dh_user@<server>.dreamhost.com:~/example.com/
With --files-from an --exclude of a folder does not drop the listed files below it, so the list itself is filtered. Another way is to exclude each folder twice, X/ and X/**. Then list the host files that the deploy list lacks, review them, and delete what is not the site:
ssh dh_user@<server>.dreamhost.com 'cd ~/example.com && find . -type f | sed "s|^\./||" | LC_ALL=C sort' > /tmp/host.txt
LC_ALL=C comm -23 /tmp/host.txt /tmp/deploy.clean.txt > /tmp/extra.txt
wc -l /tmp/extra.txt
939 /tmp/extra.txt
The count depends on the filter. This short filter keeps more files in the list, so 939 remain; the upload script's stricter list left 1,496.
Read the list before deleting anything, and never delete the data files or databases the site writes. The comparison is the same comm idea as in problem 4.
Check if you have this problem
Ask for a backup at a public address:
curl -s -o /dev/null -w '%{http_code}\n' https://example.com/index.php.bak
200
200 means the file is present; a 404 means it is not.
Over SSH, list junk by name:
ssh dh_user@<server>.dreamhost.com "cd ~/example.com && find . -type f \( -name '*.bak' -o -name '*.zip' -o -name '*.orig' -o -name '*~' -o -name '*.sql' -o -name '*.log' \) | head -n 20"
./git/tortoisegit/img/kdiff3/case_change.log ./git/tortoisegit/img/kdiff3/image_proc.log ./git/install/windows/img/image_proc.log ./aa_img/image_proc.log ./backup.zip
Compare the host files with git, images aside. This is the same comm idea as in problem 4:
ssh dh_user@<server>.dreamhost.com 'cd ~/example.com && find . -type f | sed "s|^\./||" | LC_ALL=C sort' > host.txt
git ls-files | LC_ALL=C sort > git.txt
LC_ALL=C comm -23 host.txt git.txt | grep -v -i -E '\.(png|jpe?g|gif|webp|svg|ico)$' | head -n 30
.php/_modules/_heihei/img/cards/Finland/life/image_proc.log .php/_modules/_heihei/img/cards/Finland/news/image_proc.log .php/img/cards/it/image_proc.log .php/php_includes/_cards/heihei/Finland/fests/_lux_helsinki_inc copy.php
You have it if the first command answers 200 or the lists print files. You do not have it if the backup answers 404 and the lists print nothing.
Problem 10: the error log grew to 230 MB a day
Symptom. The error log grew by hundreds of megabytes a day. Almost every line was the same deprecation warning, repeated on every request.
Command that shows it. Count the lines about dynamic properties in the copy for 2026-11-07:
grep -c 'Creation of dynamic property' ~/logs/example.com/https/error.log.2026-11-07
795171
DreamHost keeps a dated copy per day, and error.log.0 links to yesterday's.
Why. Since PHP 8.2, assigning a property the class does not declare is deprecated. Almost every line in the log was PHP Deprecated: Creation of dynamic property Site\\Php\\Related::$urls is deprecated in ..., written by mod_fcgid: stderr (the line is in DreamHost: error and access logs). The error log of 2026-11-07 was 231 MB with 804,127 lines, 795,171 of them dynamic property; the one of 2026-11-08 was 130 MB with 454,263 lines, 449,025 of them.
Fix. Declare the properties in the classes. The page engines have 11 such classes; each property gets a declaration like public $urls;:
vi .php/Related.php
class Related { public $urls; // ... }
The quick way that keeps the old behaviour is the attribute #[\AllowDynamicProperties] on the class:
#[\AllowDynamicProperties] class Related { // ... }
Deployed on 2026-11-09 at 06:43 server time; the last such line was at 06:50. From 07:00 to 11:37 the log got 321 lines, none of them Deprecated.
Check if you have this problem
Count the warnings in yesterday's copy:
grep -c 'Creation of dynamic property' ~/logs/example.com/https/error.log.0
449025
Thousands of lines mean you have it; 0 means you do not.
After the fix, find the time of the last such line in the current log:
grep 'Creation of dynamic property' ~/logs/example.com/https/error.log | tail -n 1 | cut -c1-26
[Mon Nov 09 06:50:16 2026]
A time before your deploy means the fix works; a time a minute ago means the warnings go on; no output means there were none today.
See which classes and properties repeat:
grep -o 'dynamic property [^ ]*' ~/logs/example.com/https/error.log.0 | sort | uniq -c | sort -rn | head
7744 dynamic property Site\\Php\\SxGeo\\SxGeo::$pack 7744 dynamic property Site\\Php\\SxGeo\\SxGeo::$max_region 5994 dynamic property Site\\Php\\Related::$urls 4948 dynamic property Site\\Php\\Tcont::$urls_length
The size per day:
ls -lh ~/logs/example.com/https/ | grep error
-rw-r--r-- 1 root root 19M Nov 9 12:01 error.log lrwxrwxrwx 1 root root 20 Nov 9 00:37 error.log.0 -> error.log.2026-11-08 -rw-r--r-- 1 root root 23K Nov 6 00:37 error.log.2026-11-05 -rw-r--r-- 1 root root 17M Nov 7 00:13 error.log.2026-11-06 -rw-r--r-- 1 root root 221M Nov 8 00:57 error.log.2026-11-07 -rw-r--r-- 1 root root 125M Nov 9 00:37 error.log.2026-11-08
ls -h counts in MiB: 221M is the 231 MB of the story.
Before an upload, run the same check in the checkout. Go to the document root of the checkout, here ~/site, and run PHP with a one-line bootstrap that sets DOCUMENT_ROOT:
cd ~/site
php -d error_reporting=E_ALL -d display_errors=stderr -r "\$_SERVER[\"DOCUMENT_ROOT\"] = getcwd(); include \"index.php\";" 2>&1 >/dev/null | grep -c "dynamic property"
14
On the code from before the fix it prints 14; on the fixed code it prints 0. 14 means you have it, 0 means you do not.
After all ten fixes the home page and an inner page answered 200, and an address that does not exist answered 404:
for u in http://example.com/ https://example.com/ https://example.com/about/ https://example.com/no-such-page-xyz/; do curl -sS -o /dev/null -w "%{http_code} %{redirect_url} <- $u\n" "$u"; done
301 https://example.com/ <- http://example.com/ 200 <- https://example.com/ 200 <- https://example.com/about/ 404 <- https://example.com/no-such-page-xyz/
The same checks, automated against a local copy of each host, are in the test plan for the Docker images.
Article authors: Andrei Olegovich, Klavdiya Kondakova