Skip to main content
edited title
Link
norman.lol
  • 19.1k
  • 6
  • 75
  • 129

how How to get the base urlURL of a site?

improved grammar
Source Link
avpaderno
  • 98.1k
  • 15
  • 165
  • 284

I have the a drupalMy site is on http://drupal8.local/
Howhttp://drupal8.local/. How do iI get the path drupal8.local programatically ?
All the functions like Url::fromRoute('<'current'>')drupal8.local part of that URL?

Url::fromRoute('<'current'>') or base_path() are returningbase_path() returns the url apart from base url
i.e ifpath parth of the url is URL; For example, for http://drupal8.local/a/b/c/d/e/f, those functions willthey return '/a/b/c/d/e/f'
but i/a/b/c/d/e/f' when I just need 'drupal8.local' portion.
How to get this from the url 'drupal8.local'.

How can I get that part of the URL?

I have the a drupal site http://drupal8.local/
How do i get the path drupal8.local programatically ?
All the functions like Url::fromRoute('<'current'>') or base_path() are returning the url apart from base url
i.e if the url is http://drupal8.local/a/b/c/d/e/f, those functions will return '/a/b/c/d/e/f'
but i need 'drupal8.local' portion.
How to get this from the url ?

My site is on http://drupal8.local/. How do I get the drupal8.local part of that URL?

Url::fromRoute('<'current'>') or base_path() returns the path parth of the URL; For example, for http://drupal8.local/a/b/c/d/e/f, they return '/a/b/c/d/e/f' when I just need to get 'drupal8.local'.

How can I get that part of the URL?

removed "Drupal" from the title; removed tags from the title
Link
avpaderno
  • 98.1k
  • 15
  • 165
  • 284

how to get base url of a site in drupal 8?

Tweeted twitter.com/StackDrupal/status/738100531508486144
edited tags
Link
avpaderno
  • 98.1k
  • 15
  • 165
  • 284
Loading
Source Link
Loading