Moving an SMF Forum From One Domain to Another

I needed to move a Simple Machines Forum (SMF) forum from one domain name to another. To do so, I took the following steps after creating a website for the new domain.
  1. Created a forum directory under the root directory for the new website and copied all of the forum files from the old website to it.
  2. In the root directory for a forum, there is a file named Settings.php. I edited that file, replacing all references to the old domain name with references to the new domain name.

    In the Settings.php file, you will see lines such as the following:

    ########## Forum Info ##########
    $mbname = 'My Example Forum'; # The name of your forum.
    $language = 'english'; # The default language file set for the forum.
    $boardurl = 'http://olddomain.com/forum'; # URL to your forum's folder. (without the trailing /!)
    $webmaster_email = 'webmistress@olddomain.com'; # Email address to send emails from. (like noreply@yourdomain.com.)
    $cookiename = 'SMFCookie123'; # Name of the cookie to set for authentication.

    I believe the cookiename could be the same, if the domain names differ, e.g. if I was changing from olddomain.com to newdomain.com, but should differ if you were running multiple forums under one domain name, instead of changing a domain name. I changed the number at the end of the cookiename value anyway, though.

    I also made the appropriate changes in the Directories/Files section of Settings.php.

  3. In Settings.php, I also made sure that the values for the following variables in the Database Info section were set appropriately for the new website:

    $db_name
    $db_user
    $db_passwd
    $db_prefix

    I had the value for db_prefix be the same prefix for both the new and old domains.

  4. On the forum under the old domain, I backed up the database for the forum, by clicking on Admin, then selecting Maintenance, then Forum Maintenance, then Database. Under the Backup Database section, I left the following options checked:

    I deselected the "Compress the file with gzip" option. I then clicked on the Download button and downloaded the .sql file to my laptop. That file contains a sequnce of Structured Query Language (SQL) statements that can be used to recreate all of the tables and their records for a database. All forum postings are contained within a database.

  5. I then transferred the file to the website for the new domain. When I edited the file, I saw it had DOS line endings, so I used the dos2unix command to set the line endings for the Linux system on which the new website resided.
  6. Next, I replaced every occurrence of olddomain in the .sql file I had downloaded with newdomain to reflect that the domain name was now different.
  7. From the MySQL root account, I created a new database for the user account of the user who would be managing the forum and granted her account full access to that database - see Creating a MySQL database.
  8. Then, from the user's account, I obtained a MySQL prompt, since MySQL was serving as the database management system for SMF on the system, and had MySQL execute the statements in the .sql file after selecting the new database I had created for the forum, i.e., newdomaindb.
    $ mysql -u jane -p
    Enter password: 
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 271185
    Server version: 5.0.77 Source distribution
    
    Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
    
    mysql> use newdomaindb;
    mysql> source olddomain-complete_2011-07-30.sql; 
    Query OK, 0 rows affected, 1 warning (0.00 sec)
    
    Query OK, 0 rows affected (0.00 sec)
    
    Query OK, 7 rows affected (0.01 sec)
    Records: 7  Duplicates: 0  Warnings: 0
    
    Query OK, 0 rows affected, 1 warning (0.00 sec)
    
    Query OK, 0 rows affected (0.00 sec)
    
    <text snipped>
    
    Query OK, 5 rows affected (0.00 sec)
    Records: 5  Duplicates: 0  Warnings: 0
    
    Query OK, 0 rows affected, 1 warning (0.00 sec)
    
    Query OK, 0 rows affected (0.00 sec)
    
    Query OK, 4 rows affected (0.00 sec)
    Records: 4  Duplicates: 0  Warnings: 0
    
    mysql>

    I saw some notices about warnings, but those were not worrisome since I expected to see those as a result of statements such as the following in the .sql file:

    DROP TABLE IF EXISTS `smf_admin_info_files`;

    Since there were no existing tables in the database, I would expect to see warnings produced from such statements.

  9. I then removed all log entries from when the forum resided on the old domain name, by clicking on Admin, Features and Options, Maintenance, and Logs.
  10. Since the package httpBL was installed under the old domain name, I verified its configuration was correct by clicking on Admin, Features and Options, Members, MOD httpBL, and Settings. I obtained a new honeypot script from the Project Honey Pot website, placed the script on the website for the forum and activated the script. The same access key from Project Honey Pot can be used on multiple sites, so I didn't need to change the access key.
  11. The Stop Spammer package was also installed, so I needed to get a new API key for it from the Stop Forum Spam site. I obtained a new API key for the new domain name from that site. Then within the SMF forum, I clicked on Admin, Features and Options, Members, Registration, then Settings. I replaced the API key for the old domain with the one I just generated for the new domain and then clicked on Save to save the settings.
  12. The forum was using the Google Member Map mod, so I had to generate a new Google Maps API key. When I went to view the Google Member Map by clicking on the Member Map link on a forum page, I saw the message "This web site needs a different Google Maps API key. A new key can be generated at http://code.google.com/apis/maps/signup.html." I went to that location, and signed in using a Google account to get a new API key for the new domain name. I then entered the new key for the SMF forum by clicking on Admin, Configuration, Modification Settings, and selecting Member Map. I put the new key in the "The API key from the Google Maps API Page" field and then clicked on the Save button. Then when I clicked on Member Map at the top of a forum webpage, I could see the Google member map.

References:

  1. SMF Cookie Name
    Simple Machines Forum (SMF)
  2. .SQL File
    FILExt - The File Extension Source
  3. SQL
    Wikipedia, the free encyclopedia
  4. OS X Line Endings
    MoonPoint Support
  5. Creating a MySQL Database
    MoonPoint Support
  6. MySQL
  7. MySQL 5.0 Reference Manual :: 3.5. Using mysql in Batch Mode
    MySQL :: Developer Zone
  8. Show Warnings in MySQL
    MoonPoint Support

 

TechRabbit ad 300x250 newegg.com

Justdeals Daily Electronics Deals1x1 px

Valid HTML 4.01 Transitional

Created: Sunday, July 31, 2011