In Drupal 7 I put in settings.php this:

$base_url = 'http://mysite.local';

And when I run:

$ drush uli

The url generated will be fine.

In Drupal 8 I check and still there.

But in my Drupal 8 site, when I try run: $ drush uli

I got:

mysite does not appear to be a resolvable hostname or IP, not starting browser. You may need to use the --uri option in your command or site alias to indicate the correct URL of this site.                          [warning]

I know I can do this: $ drush uli --uri='mysite.local'

But much work.

Too I can do this with some drush config.

Then, how I do this like Drupal 7 in settings.php?

3 Answers 3


Since Drupal 8 uses Symfony's request stack which generates the base url, some things are not possible to do in the same manner as was possible in Drupal 7.

Instead create sites/default/drushrc.php and add


$options['uri'] = 'http://mysite.local';

and you should be fine.


@googletorp's answer led me in the right direction (thank you!), but was not the correct answer for me. I am on Drupal 8.6 and drush 9.7. Instead of a drushrc.php file, a drush.yml file was needed.


specifically, this configuration within it (options is a top-level element):

  uri: 'http://mysite.local'

There was already a drush.yml file located at /drush/drush.yml so this is the one I used.

  • 1
    Hmmm I can confirm drushrc.php no longer works and also the config path /sites/default/drush.yml is no longer included by drush so it doesn't look like there's a clean way to commit this setting to version control any longer. Sep 18, 2020 at 8:56

for drupal 8.9 and drush 9.7.2

In the outputted list from

drush status

you will see: "Drush configs". It shows the path or paths to drush configuration files. i.e. /var/www/mysite/drush/drush.yml

in that file you can add:

  uri: 'http://mysite.local'

drush should pick it up immediately, or after

drush cc drush
  • Very helpful as of Dec. 2020. Mine shows two files: one in home/ directory; another in the project's vendor/ directory. So for those using composer, it may be the vendor/ one, which may/may not be wise to edit.
    – BWagner
    Dec 11, 2020 at 17:57
  • You can also add an additional site specific drush config to define your site uri. See drupal.stackexchange.com/questions/263954/… for details. Nov 24, 2021 at 15:29

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.