bcsteeve Posted July 16, 2015 Share Posted July 16, 2015 So I just moved my site from my local server that had a domain of simply "shop3" to my real server with a real domain. I had my doubts it would work well, but I trusted the guide. I was right.. it didn't work well. I had to go through the database and do about 1400 search and replaces. It wasn't just so simple as redefining the domain in the SEO settings page. It would have been if I never make a link on mysite, but how common is that? I'm sure most of us find the need to say, for example, "if you're looking for XYZ, go to this product" and link. All those links still go to the old domain. I figured the system was automatically keeping track of these things and would re-write them with the new domain, but I guess I was wrong. Link to comment Share on other sites More sharing options...
omine Posted July 17, 2015 Share Posted July 17, 2015 Normally, just change some settings on configuration table and clear the cache. When i need to change the domain, i just run the queries bellow USE database_name; UPDATE ps_configuration SET value = 'www.prestashop.com' WHERE name = 'PS_SHOP_DOMAIN'; UPDATE ps_configuration SET value = 'www.prestashop.com' WHERE name = 'PS_SHOP_DOMAIN_SSL'; UPDATE ps_configuration SET value = 'http://www.prestashop.com/livezilla/' WHERE name = 'LIVEZILLA_URL'; UPDATE ps_configuration SET value = 'http://www.prestashop.com/2715-bla-bla' WHERE name = 'BLOCKADVERT_LINK'; UPDATE ps_configuration SET value = 'http://www.prestashop.com/prestashop.rss' WHERE name = 'RSS_FEED_URL'; UPDATE ps_configuration SET value = 'http://www.prestashop.com' WHERE name = 'CANONICAL_URL'; UPDATE ps_configuration SET value = 'http://www.prestashop.com' WHERE name = 'MB_CANCEL_URL'; UPDATE ps_configuration SET value = 'http://www.prestashop.com/cms.php?id_cms=4' WHERE name = 'TMADVBLOCK2_LINK'; UPDATE ps_configuration SET value = 'http://www.prestashop.com' WHERE name = 'TMADVBLOCK3_LINK'; UPDATE `ps_shop_url` SET domain = 'www.prestashop.com', domain_ssl = 'www.prestashop.com', physical_uri = '/'; Some queries depends for each case. Example, if you do not use "livezilla", don't need to run livezilla querie. To figure out where to change, just search. SELECT name FROM ps_configuration WHERE value LIKE '%domain_name%'; For "domain_name", do not include the subdomain and the top level name. Example For "www.prestashop.com" SELECT name FROM ps_configuration WHERE value LIKE '%prestashop%'; For "shop.anything.uk" SELECT name FROM ps_configuration WHERE value LIKE '%anything%'; Link to comment Share on other sites More sharing options...
bcsteeve Posted July 17, 2015 Author Share Posted July 17, 2015 (edited) Thanks for that... helpful info. But it still doesn't help for the majority of my problem, which are links in things like descriptions, banners, menus or the myriad of other times a link is used among text and not as a settings. Yes, I can search the database... that's what I had to do. That's the "yuk". It would be better if, as an example, when I'm typing out a product description that I can use things like: So this is a <a href="%URL%/my_other_product">link to another product</a> that you might enjoy. But if that is a possibility, I have yet to find documentation relating to it. Ideally, it would be right in the editor so when I click "add link" I get an option of a file system browser so I can select the link (no typos). And when it is time to move servers or domains.. it really is just a setting. Anyway, I did the search and replace for the 1608 instances so it is no longer an issue I need to resolve. It just sucked arse doing it. In the end, the easiest thing proved to be re-dump the SQL, open it up in Notepad++ and search/replace. But when you're talking about a database that large, nothing is as simple as that seems. Crashed my machine twice (time to upgrade) Edited July 17, 2015 by bcsteeve (see edit history) Link to comment Share on other sites More sharing options...
omine Posted July 17, 2015 Share Posted July 17, 2015 (edited) I understood your case. To avoid this problem, just write the relative path instead of full url. Example, instead of type "http://yourdomain.com/folder/blabla.html", use the relative path without domain name or the protocol: "/folder/blabla.html". The suggested tag (%URL%) couldn't be necessary for this case. However, still have a problem. If change the website uri base, still need to replace all texts. I don't know if there's proper way to solve. I would like to know. Perhaps, inserting smarty tags into text. But i'm not sure if the text will be compiled by smarty engine, cause i never did before. Take a look on this thread: https://www.prestashop.com/forums/topic/263420-solved-how-to-get-site-baseurl/ off topic n the end, the easiest thing proved to be re-dump the SQL, open it up in Notepad++ and search/replace. But when you're talking about a database that large, nothing is as simple as that seems. Crashed my machine twice (time to upgrade) I suggest you to not dump entire database for this case. You don't need search and replace into the big tables like logs, orders, customers, products, cart, etc.. Just export the obvious tables you presumes that may contains the URLs you want replace. Use text editor like Noptepad++ to perform replace into multiple files and folders. If possible, use the MySQL Workbench or any other reliable MySQL Client to export the data. Some MySQL Clients have feature to split the exported data. Example, split the file for each 10k rows. Edited July 17, 2015 by omine (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts