Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel5: Get base url or home url of the Laravel application [duplicate]

Tags:

php

laravel-5

How can I get the base url or home url of the Laravel application ?

I have seen similar question. And all of them are based on laravel 4. I have tried the suggesting answer But none of these work in laravel 5. So please consider this things before vote down or treat this as a duplicate.

like image 710
Ahmad Sharif Avatar asked Apr 07 '15 04:04

Ahmad Sharif


People also ask

How do I find the base URL?

To find the base URL of your website, go to the site's front page. What you see in the address bar on your site's front page is the base URL of your website.

What is URL () in Laravel?

url() Generates an absolute URL to the given path (code)Preserves any URL query string. {{ url('search') }} // http://www.example.com/search {{ url('search', ['qevo', 'laravel']) }} // http://www.example.com/search/qevo/laravel.


1 Answers

You can get the base url of the Laravel application by:

echo url('/'); 

or

{{ url('/') }} 

Read more about Laravel helpers here

like image 134
Sulthan Allaudeen Avatar answered Oct 11 '22 09:10

Sulthan Allaudeen