Site address: what it is and how to fix a wrong one
Why the engine needs the site address, why it is sometimes recorded wrongly and how to fix it with one button.
The site address is the 'url' line in the settings file (for example https://example.com). The engine remembers it so that it can build addresses where there is no browser to say where you are: in emails, in the sitemap, in social cards.
What depends on it
The sitemap and robots.txt, links in emails, social cards, the return from a payment and the www redirect are all built from this address. While it is recorded wrongly, all of them point to the wrong place: emails invite people to a foreign or closed address, search engines get the map of another site, and cards in messengers show the wrong link.
Why it can be wrong
- The site was moved by copying to another host or another domain, and the settings file travelled with the old address.
- The site moved from http to secure https but the file still says http.
- The site was built on a temporary hosting domain and the real one was connected later.
- A copy was restored at a different address from the one it was taken at.
- localhost, an IP address or a name without a dot is recorded: a leftover from development at home.
Where you see it
The engine compares the recorded address with the one you opened the panel at. If they differ you will see:
- a strip on the panel home page;
- the line “Site address is recorded wrongly” in “What to improve” (the SEO section);
- a card with the reason and both addresses in “Diagnostics → System status”;
- a warning in the php nex1on doctor check;
- a reminder after restoring a copy, if the copy brought a foreign address.
How to fix it
Open “Diagnostics → System status” and press “Change to …” (the button shows the address the panel is open at). What happens:
- The button is for the site owner only, and the password is asked again.
- One line changes in the file where it is set:
config/local.php, orconfig/app.phpif it is not there. The rest of the file is untouched. - The previous file is saved as a copy in
storage/backups(the last five are kept) and the change goes into the change log. - Before you press, the panel reminds you that all visitors and search robots will then be redirected to the new address.
There is no button if “General settings” already name a different site address from the one the panel is open at: this often happens when you came in by a temporary domain. One button fixes nothing then, and the panel says why. Open the site at its real address and repeat the check from there.
If the file cannot be written
Sometimes the settings file cannot be changed from the site itself (folder permissions). The panel then shows which file to edit and the ready line. Open the file on the server (by FTP or in the hosting panel) and put in a line like:
'url' => 'https://example.com',The address has no slash at the end and uses https if the site has a certificate. After editing, open “System status” again: the address card should be gone.
When there is nothing to fix
If you open the panel at a temporary address to check the site before moving, leave everything as is: the real address must be recorded for the real domain. Fix the address while the panel is open at the address visitors will see.