0

I have content in drupal (Blocks, Pages etc.) where absolute links have been inserted. I moved the site and the urls in the blocks and pages are still pointing to the old domain.

How can I change this in the database? Which database table do I need to target? I want to do something like:

UPDATE table SET content = REPLACE(content,'www.domain.com/old','www.domain.com/new');

Thanks!

Torben
  • 5,388
  • 12
  • 46
  • 78

3 Answers3

0

Drupal it self is not using absolute paths (like i.e. WordPress does) so moving "common" Drupal websites doesn't require any intervention like this. My advice is to always use root relative paths for internal links.

Basically you would have to replace ALL appearances of old domain with new one, so it would be best to export your database to sql file, do search/replace on that sql file and then import changed dump file to new domain database. Maybe clear all the caches before database export to reduce database size...

MilanG
  • 6,994
  • 2
  • 35
  • 64
0
  1. Backup your database first!
  2. Install Adminer script and search whole database for previous (old) domain name. Or build SQL-query to search all tables if you like command line interface
  3. See How to search and replace all instances of a string within a database? to know how to replace string in whole database.

Community
  • 1
  • 1
VladSavitsky
  • 523
  • 5
  • 13
-1

Making this change to the database may not be the best practise, why don't you instead try using the base html tag within the head tag in the .html template file:

<head>
<base href="http://www.domain.com/new"
</head>

Refer to for more information on this tag: http://www.w3schools.com/tags/tag_base.asp

Thalia
  • 19
  • 4