Score:0

Search and Replace URL in database?

us flag
jfc

I need to move a Drupal 9 website to a different server and a lot of links have the old server URL. Normally for Word Press I use this tool - https://github.com/interconnectit/Search-Replace-DB https://interconnectit.com/search-and-replace-for-wordpress-databases/

You upload that to the server and it runs a script to search for your string and replace it with the new string.

I tried to do a regular search and replace in VS Code with -

Search //old.url.com Replace with //new.url.com

It found all the //old.url.com but after I imported the database there are still some links that do not redirect to the new url, one of these is /user. If I go to new.url.com/user it redirects to old.url.com/user

Is there a way to do a search and replace on the database to replace the old URL?

4uk4 avatar
cn flag
/user redirects to different internal routes depending on the logged-in state. Routes are not site specific and a cache clear should remove any cached redirects.
jfc avatar
us flag
jfc
How can I clear the cache if I can't log in?
4uk4 avatar
cn flag
See https://www.drupal.org/docs/user_guide/en/prevent-cache-clear.html
Alfred Armstrong avatar
cn flag
Don't replace the old URLs by new absolute ones, replace them by relative URLs and you won't have to go through this again.
Score:0
se flag

You can use HeidiSQL utility Select search -> Replace text ...

enter image description here

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.