Questions tagged [relative-url]

A URL that is relative to another URL.

For example "image/logo.gif" is a relative URL, which full path can only be resolved by taking into account its parent URL. For example if a document is located at http://example.com/test, the full URL of that image would be http://example.com/test/image/logo.gif.

118 questions
155
votes
2 answers

Two forward slashes in a url/src/href attribute

Possible Duplicate: URI starting with two slashes … how do they behave? Absolute URLs omitting the protocol (scheme) in order to preserve the one of the current page shorthand as // for script and link tags? anyone see / use this before? I was…
Michael Parkin
  • 1,705
  • 2
  • 11
  • 13
63
votes
3 answers

Relative path in HTML

I am creating a website on localhost. I want to make all of link resources in my website to relative path ( I mean only internal resources). website is located in http://localhost/mywebsite I read this useful question Absolute vs relative URLs. I…
Amir
  • 701
  • 1
  • 5
  • 11
61
votes
3 answers

How to get "raw" href contents in JavaScript

I am trying to write a GreaseMonkey script in which I want to find all of the links that are relative links. It seemed to me that the way to do that would be to match the contents of href against /^https?:///. But I find that when I access the…
wfaulk
  • 1,583
  • 1
  • 14
  • 22
36
votes
4 answers

Why use protocol-relative URLs at all?

It's been an oft-discussed question on StackOverflow what this means: This gives the advantage that if you're accessing it over HTTPS, you get HTTPS automatically, instead of that…
oink
  • 1,243
  • 2
  • 12
  • 22
33
votes
5 answers

Absolute urls, relative urls, and...?

I am writing some documentation and I have a little vocabulary problem: http://www.example.com/en/public/img/logo.gif is called an "absolute" url, right? ../../public/img/logo.gif is called a "relative" url, right? so how do you call this:…
MiniQuark
  • 40,659
  • 30
  • 140
  • 167
26
votes
7 answers

PHP: How to resolve a relative url

I need a function that given a relative URL and a base returns an absolute URL. I've searched and found many functions that do it different ways. resolve("../abc.png", "http://example.com/path/thing?foo=bar") # returns http://example.com/abc.png Is…
Paul Tarjan
  • 44,540
  • 54
  • 163
  • 207
16
votes
4 answers

Building an absolute URL from a relative URL in Java

I'm having trouble building an absolute URL from a relative URL without resorting to String hackery... Given http://localhost:8080/myWebApp/someServlet Inside the method: public void handleRequest(HttpServletRequest request, HttpServletResponse…
Marty Pitt
  • 26,266
  • 34
  • 115
  • 190
13
votes
3 answers

Is Java's URI.resolve incompatible with RFC 3986 when the relative URI contains an empty path?

I believe the definition and implementation of Java's URI.resolve method is incompatible with RFC 3986 section 5.2.2. I understand that the Java API defines how that method works, and if it were changed now it would break existing apps, but my…
Martin Pain
  • 653
  • 3
  • 17
11
votes
7 answers

Checking for relative vs absolute paths/URLs in PHP

I need to implement functions to check whether paths and urls are relative, absolute, or invalid (invalid syntactically- not whether resource exists). What are the range of cases I should be looking for? function check_path($dirOrFile) { // If…
Yarin
  • 144,097
  • 139
  • 361
  • 489
10
votes
3 answers

How can I convert a relative link in Mechanize to an absolute one?

Is there is a way to convert a Mechanize relative-link object to another one which contains the absolute URL. Mechanize must know the absolute link, because I can call the click method on relative links too.
Konstantin
  • 2,575
  • 2
  • 26
  • 47
7
votes
3 answers

Rails relative_url doesnt adjust links

After failed attempts with Passenger (see my other question), I managed to get rails running via a reverse proxy in a subfolder. I added the lines config.relative_url_root = "/App" config.action_controller.relative_url_root = "/App" to my…
yell
  • 103
  • 1
  • 6
6
votes
2 answers

Absolute URL from relative path

I've got a base URL and some relative URIs in that document I want to have the absolute path of. E.g. base = https://example.com/some/path.html?query=string and relative URIs in that document: index.html → https://example.com/some/index.html .. →…
kay
  • 23,543
  • 10
  • 89
  • 128
6
votes
2 answers

Double slash at beginning of javascript include

I have been looking at the html5 boilerplate and noticed that the jquery include url starts with a double slash. The url is //ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js Why is the http: missing?
David
  • 61
  • 1
  • 2
6
votes
2 answers

Cloudfront, EC2 and Relative URLs

This is probably a simple question, but I can't find a straightforward answer anywhere. My website is hosted on Amazon EC2. I want to take advantage of Amazon Cloudfront to speed up the loading of the images, Javascript and CSS on my…
Gio Hunt
  • 96
  • 4
5
votes
2 answers

How to work with submodules and n-tiers git repository strategies

We are migrating to git. We have a large number of modules that make up our products, some of them are shared between products. The product is represented by a "thin" super repository (ssh://server/product.git) that only contains…
simon
  • 645
  • 10
  • 19
1
2 3 4 5 6 7 8