Recently I was developing a new website under Mephisto and multisite config. I developed site under temporary hostname. Below are the steps needed to change hostname of running Mephisto instance.

Lets assume old host of the site was dev.example.com. New host will be www.example.com.

In table sites update column host to have value example.com. Also update Apache config to understand the new hostname. Now Mephisto is ready to answer in new hostname.

Articles containing images or other assets still have old hostname in their url. They can be easily changed with MySQL’s REPLACE command. Four columns have to be updated in contents table:

UPDATE contents 
    SET body = 
    REPLACE(body, 'dev.example.com','www.example.com');
UPDATE contents 
    SET body_html = 
    REPLACE(body_html, 'dev.example.com'','www.example.com');
UPDATE contents 
    SET excerpt_html = 
    REPLACE(excerpt_html, 'dev.example.com'','www.example.com'); 
UPDATE contents 
    SET excerpt = 
    REPLACE(excerpt, 'dev.example.com'','www.example.com');

Last thing to change is the name of asset directory under mephisto folder.

 >cd /www/mephisto/public/assets 
 >mv dev.example.com www.example.com
Thats it. Fire up you browser. Clear caches from Mephisto admin and check everything is ok.

UPDATE: There still seems to be problem with new assets being uploaded to wrong folder. Temporary fix for this is to make a symlink:

 >cd /www/mephisto/public/assets 
 >ln -s www.example.com example.com

I’m sure there is a better way.


Sorry, comments are closed for this article.