In Drupal 7, we can quickly change the base URL of the website.
How can I do this, in Drupal 8?

2 Answers 2


In Drupal 8 this option has been removed. You don't have to configure base_url to run your site. Drupal 8 can detect this without your help. If not, you should first check your webserver configuration.

Instead of base_url you should configure trusted_host_patterns in settings.php. This is not needed to run the site, but important for security reasons.

More info: Removed base_url option from settings.php and New setting for trusted hostname configuration


There are some special use cases when running drupal from command line or reverse proxy, that used $base_url in the past. This can no longer be supported in the same way because of symfony. There is a discussion going on how to provide a solution for these cases. This does not mean that you cannot run drupal from the command line or reverse proxy. The standard way is of course possible without problems.

You can follow the development here: https://www.drupal.org/node/2753591


I thought once some kind of tweaks were needed when moving between production (http:// example.com/) and dev (http:// localhost/~aviram/example.com/). But no, D8 is smart enough to fix links automatically.

After moving a complete site (PHP files and DB dump), just go through the D8 database update process (http://example.com/update.php) even if there is no update for the database model. This fixes the problem.

I learned this is a Drupal 8 cache-related problem probably because some pre-rendered content is kept in sites/default/files/php/. And the update.php process somehow cleans this cache.

  • 4
    Yes, /update.php always clears the cache, even if there are no updates to run. This is a nice trick to get a site running after moving it to a new place, if you don't want or can't access another method to clear the cache.
    – 4uk4
    Aug 3, 2017 at 12:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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