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?

  • 1
    /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.
    – 4k4
    Dec 22 '21 at 17:01
  • How can I clear the cache if I can't log in?
    – jfc
    Dec 22 '21 at 18:15
  • 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. Dec 24 '21 at 13:41

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

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.