Questions tagged [base-url]

350 questions
253
votes
18 answers

Laravel: Get base URL

Simple question, but the answer seems quite hard to come by. In Codeigniter, I could load the URL helper and then simply do echo base_url(); to get my site's URL. Is there an equivalent in Laravel?
Inigo
  • 8,110
  • 18
  • 62
  • 110
105
votes
14 answers

Getting the base url of the website and globally passing it to twig in Symfony 2

I'm making the switch from CodeIgniter to Symfony 2. Can someone please give me an example of how to: Get the base url (the url without the route specific parts) Globally pass this variable to the twig bundle so I can use it in every template.
Geoffrey De Vylder
  • 3,963
  • 7
  • 36
  • 56
100
votes
6 answers

How to get domain URL and application name?

Here's the scenario. My Java web application has following path https://www.mywebsite.com:9443/MyWebApp Let's say there is a JSP file https://www.mywebsite.com:9443/MyWebApp/protected/index.jsp and I need to retrieve…
ericbae
  • 9,604
  • 25
  • 75
  • 108
88
votes
16 answers

How to get base URL in Web API controller?

I know that I can use Url.Link() to get URL of a specific route, but how can I get Web API base URL in Web API controller?
Nikolai Samteladze
  • 7,699
  • 6
  • 44
  • 70
73
votes
2 answers

How get the base URL via context path in JSF?

I have this structure: WebContent resources components top.xhtml company about_us.xhtml index.xhtml top.xhtml is a component, that is used in index.xthml and about_us.xhtml too. top.xhtml
66
votes
16 answers

How to get page URL or hostname in NextJs Project?

I want to get the page's full URL or site hostname like the image below on Static Site Generator. I will try with window.location.hostname, but it doesn't work. The error: window not defined.
Raju Ahammad
  • 873
  • 2
  • 9
  • 15
56
votes
8 answers

Using base tag on a page that contains SVG marker elements fails to render marker

I've run into a problem while attempting to use SVG marker elements in an SVG based visualization. I'm adding my changes to a web application which happens to include a base tag on every page, so that any references to CSS files, javascript files,…
DaViS
  • 623
  • 1
  • 6
  • 8
54
votes
15 answers

Get Root/Base Url In Spring MVC

What is the best way to get the root/base url of a web application in Spring MVC? Base Url = http://www.example.com or http://www.example.com/VirtualDirectory
Mike Flynn
  • 22,342
  • 54
  • 182
  • 341
37
votes
3 answers

How to get base url without accessing a request

How to get the base URL in AspNet core application without having a request? I know from the Request you can get the scheme and host (ie $"{Request.Scheme}://{Request.Host}" would give something like https://localhost:5000), but is it possible to…
diegosasw
  • 13,734
  • 16
  • 95
  • 159
31
votes
5 answers

Can I get a "base URL" in WordPress within a template file?

Usually in my PHP apps I have a base URL setup so I can do things like this Tom Then I can move my site from development to production and swap it easily and have the change go site wide (and it seems…
alex
  • 479,566
  • 201
  • 878
  • 984
22
votes
9 answers

importing image dynamically (React Js) (Require img path cannot find module)

I need to import images(several) from my image file dynamically by a map method. First, I want to set a base URL to my images file and then read the image's name from my JSON file which includes the image property and then set the image src…
Vahid
  • 1,258
  • 1
  • 14
  • 14
16
votes
2 answers

How to use Jekyll baseurl in css files

I'm using Jekyll to host a site on Github pages. The problem lies in referencing file paths within css files. I'd like to do something like this: body { {background: #FFF url('{{ site.baseurl}}/images/page_bg.JPG') center 0 no-repeat;…
Scott Decker
  • 4,229
  • 7
  • 24
  • 39
16
votes
2 answers

What exactly is a baseUrl

I have spent sometime trying to understand what a baseUrl is(from learning Zend Framework), but it's surprising that for such a ubiquitous utility, not a single "expert" or blogger has even attempted to define baseUrl so that a learner has an idea…
okey_on
  • 2,888
  • 8
  • 28
  • 36
14
votes
4 answers

How to change swagger documentation base url?

Everything is working great locally, but I want to change localhost:portNumber with some domain name. So that I may access it from anywhere rather than just consulting my local machine. I didn't find anything helpful in making swagger documentation…
Hasan Badshah
  • 773
  • 1
  • 6
  • 16
13
votes
2 answers

how to fetch base url from the given url using java

I am trying to fetch base URL using java. I have used jtidy parser in my code to fetch the title. I am getting the title properly using jtidy, but I am not getting the base url from the given URL. I have some URL as input: String s1 =…
DJ31
  • 1,219
  • 3
  • 14
  • 19
1
2 3
23 24