15

When I run drush user-login username, drush prints a url like http://default/user/reset/1/32323933.... How do I replace default with the actual website name?

1
  • Not tried it so posting a quick comment, the variable site_name is used to save the name of the site in Drupal 6, the command drush vget site_name would give out the same, so probably drush vset site_name WHATEVER_NAME_TO_SET should do the work... Dec 25, 2012 at 14:27

3 Answers 3

15

You can use option --url:

-l <http://example.com:8888>, URI of the drupal site to use (only needed in multisite environments or when running on an alternate port).
--uri=<http://example.com:8888>

$  drush uli -l yoursite.dev

Or create a record in your aliases.drushrc.php file:

$aliases['yoursite-dev'] = array(
  'root' => '/vhosts/yoursite.dev',
  'uri' => 'yoursite.dev',
);

Now you have an alias @yoursite-dev and can use it:

$ drush use @yoursite-dev
$ drush uli

Update:

Now I prefer to create sites/default/drushrc.php file for each Drupal folder:

<?php
$options['l'] = 'http://yoursite.dev';
$options['r'] = '/vhosts/yoursite.dev';

More info about drushrc.php: https://github.com/drush-ops/drush/blob/master/examples/example.drushrc.php

2

I used this command for login into my local site:

drush uli --uri=http://your_local_url
0

You can set the uri in a drush site alias file to avoid getting http://default at the beginning of your password reset links.

ie. drush/sites/example.sites.yml

live:
   host: server.example.com
   user: user   
   ssh: '-p 22'
   root: /home/user/public_html/docroot
   uri: 'http://example.com'
test:
   host: server2.example.net
   user: user2
   ssh: '-p 22'
   root: /home/user2/public_html/docroot
   uri: 'http://test.example.net'
dev:
   host: localhost
   user: docker
   root: /var/www/docroot
   uri: 'http://example.dev.example.com'

Then use the Drush site alias in the command for the password reset link:

drush @example.dev uli

The example after the @ symbol in the Drush site alias comes from the first part of the Drush site alias filename. The second part comes from the site entry in the file.

Your Answer

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

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