I have painstakingly moved my production site to a local dev server to do some offline edits. However, all of the internal site links located in the body of whatever page still point to the production site.

How do I temporarily redirect urls in the body of pages to the local dev server?

I need


to redirect to


NOTE: All the drupal nav pages via admin menu work correctly. Seems like a common problem, but I can't find a straight forward solution.


you could make an entry in your hosts file, like      examplepage.org
  • Your answer is simple and superb. I didn't quite grasp why the apache2 "virtual host" concept was such a "big deal", but the moment I saw your answer, the "virtual host" concept "sunk in"... thanks.
    – yupthatguy
    Jul 15 '15 at 1:37

If there is given hard coded URL then you need to change it one by one , and if its coming through program or Drupal standard behavior then you can check it with clearing the cache.

Following are the way you can check:

1. Check settings.php to ensure that $base_url is set to "http://localhost"

2. Check settings.php to ensure that MySQL settings are correct

3. Take an SQL dump of the entire local database and searched for any references to live site URL

4. Delete all the local cache data from database

5. Check various blocks to ensure that there was no hard coding of links

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.