The purpose of this tutorial is to guide existing phpBB users in relocating their default forum installation. It is particularly relevant if you are in the process of moving hosts.
Notify your users and moderators
If possible, provide as much notification to your users and moderators about any expected downtime. Begin by posting an annoucement on your forum, followed by a mass email to your users nearer the time. When you are ready to proceed, de-activate the forum via the ACP. It is crucial that this is done to ensure no further amendments are made to the database.
Back up, back up, back up!
I can not stress this enough; make backups of your data. Then make a backup of your backup, because things can go invariably awry with the ‘active’ copy of your backup.
Your database(s) can be backed up using phpMyAdmin (in most instances, this is already installed by your host and can be accessed via your website control panel). You may also wish to consider using a desktop database GUI client such as SQLyog. The free version of this software is sufficient for our purposes.
If you have a relatively small database you can export all the data via phpMyAdmin’s Export feature. For larger forums (database data > 20MB) I would recommend that you split your export into smaller batches of tables. You’ll note that the phpbb_posts, phpbb_posts_text, phpbb_privmsgs_text and phpbb_search_wordmatch tables contain the bulk of your data, and I would suggest you back these up seperately. When exporting your tables, ensure that the option for ‘Extended Inserts’ is disabled.
Upload your data
Upload all your files to your new host. If you have not yet initiated domain transfer to point to your new hosts servers, connect to your server via the IP address provided by your new host. If necessary, update config.php in your forum/ directory to reflect the new database/server credentials.
Restoring your database
Create a new database via your new hosts control panel. Next, download bigdump.php. BigDump is a lightweight PHP script which staggers the import of your SQL file. Without it, you may experience MySQL timeout errors. Make the necessary amendments to bigdump.php to reflect your new database settings. Upload this, together with your SQL files, to your server. You can then initiate the import of your database by accessing bigdump.php directly from your browser. Continue doing this until all your tables have been restored.
You may also wish to consider using SQLyog’s ‘transfer database’ option to propogate your database data directly from your existing host to your new host, without needing to make any SQL backups. (I must add that this didn’t work for me; possibly because my post tables were particularly large).
Once the data has been transferred, and you are satisfied, arrange to have your DNS/nameserver information amended to reflect that of your new host.
If the location of your forum has not changed (i.e, you’ve simply moved hosts, and have retained directory structure) you should be able to log in to your forum. Don’t forget to re-activate the forum via the ACP.
If the forum has changed location (i.e, if you renamed the forum directory from phpBB2/ to forum/, or installed at root level) be sure to use the Auto Cookies mod to correct your path data.
Redirect visitors with .htaccess
If you have changed the forum directory, you may still receive requests to the old location of your forum. Rather than serve an ugly 404 error, you can seamlessly re-direct this traffic to the new forum location, whilst retaining topic/posts data in the URL.
Create a new .htaccess file and save it (at root level) with the following command:
RewriteEngine On RewriteRule ^OLD/(.*)$ http://www.example.co.uk/NEW/$1 [R=301,L]
Replace ‘OLD/’ with the old directory name, whilst also replacing the URL to reflect the location of your new phpBB install. The above rewrite command will redirect requests to the new location via a transparent 301 ‘Moved permanently’ header.
That’s all folks. If you need any further assistance please ask at the phpBB support forums.