WordPress migration to TransIP Webhosting Platform
Context: Around 2023.11, I'm migrating a site from a VPS to a TransIP Webhosting Platform, which is the name for the usual TransIP shared hosting platform. This article isn't complete: It might only mention the stuff I'm struggling with.
Test-URL - Figure out what it is
It seems that sites are by default available on a TransIP test URL. How to figure out this test URL:
TransIP console » Domein & Hosting » Webhosting beheren » Website » SFTP/SSH
- Copy the host name
- Replace
.ssh.
with.site.
Test URL - Get site to work
When migrating a site to a new URL (which is what we're doing when testing a site on the TransIP test URL), I use
wp search replace <old url> <new url>
to update all links on the site to the new URL. Here, TransIP has this suggestion, which I think is pretty cool [1]:
Om de test URL voor Wordpress bereikbaar te maken is nog een extra aanpassing nodig. Wordpress gebruikt namelijk een eigen, interne instelling om de URL van de website te bepalen. Als je een website wil verhuizen wil je uiteraard voorkomen dat Wordpress zichzelf naar de oude hosting terugverwijst, wat kan gebeuren als je op het dashboard probeert in te loggen. Om dit te regelen moeten de onderstaande regels worden toegevoegd aan het wp-config.php bestand (in de root folder van jouw website). Voeg deze toe boven de regel waar staat '/* That's all, stop editing! Happy publishing. */': define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST']); define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST']); Let op dat je mogelijk een foutmelding ziet als je naar de test URL probeert te gaan, omdat SSL hier niet op werkt. Deze kun je negeren (door op 'Doorgaan' te klikken in jouw browser). Denk eraan om deze regels weer te verwijderen wanneer de website volledig is verhuisd, zodat Wordpress zelf de nodige opties kan beheren.
However, it didn't seem to work. And suprisingly,
wp search-replace <old-url> <new-url>
dit work!
Test URL & SSL
You can't enable or disable SSL on the test-URL, so you'll have to live with these warnings about an absent SSL certificate. OK.
Chmod - Rights on files & folders
I thought that when you FTP stuff to a shared hosting account, that it automatically gets the right attributes. That doesn't seem to be the case: See the .htaccess error below
Problem: Missing .htaccess file?
Complete error:
You don't have permission to access this resource. Server unable to read htaccess file, denying access to be safe
This problem seem to have been caused by incorrect file/folder permissions.
Solution?
This worked for me, from the root of the installation:
chmod -R 755
TransIP confirmed, that 755
(or, to my surprise, 777
) is fine.