Questions tagged [base-url]

326 questions
213
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
  • 6,604
  • 15
  • 52
  • 94
99
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,378
  • 22
  • 73
  • 103
96
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,621
  • 5
  • 33
  • 55
78
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,337
  • 4
  • 41
  • 70
70
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
55
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
  • 613
  • 1
  • 5
  • 8
39
votes
13 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
  • 21,905
  • 50
  • 167
  • 308
31
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
  • 8,724
  • 7
  • 66
  • 106
30
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
  • 438,662
  • 188
  • 837
  • 957
17
votes
4 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
  • 952
  • 1
  • 10
  • 13
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,199
  • 3
  • 13
  • 19
13
votes
5 answers

React Router's HashRouter redirects to tag url

I have non-SPA server-side application with React application that is limited to current page, /some/static/page. The application has in on all pages and relies on it, this cannot be changed. Here is basic example with React…
Estus Flask
  • 150,909
  • 47
  • 291
  • 441
13
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
  • 3,659
  • 5
  • 21
  • 36
12
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
  • 639
  • 1
  • 6
  • 14
12
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,288
  • 5
  • 23
  • 35
1
2 3
21 22