nextdoordoc
nextdoordoc

Reputation: 1767

Relative URL to Absolute URL

Base URL : "http://example.com/foo/bar" Relative URL : /hoge/fuga

Then is Absolute URL is "http://example.com/hoge/fuga" or "http://example.com/foo/bar/hoge/fuga" ?

Thanks in advance!

Upvotes: 0

Views: 89

Answers (1)

Atilla Ozgur
Atilla Ozgur

Reputation: 14701

I assume you are asking how to calculate from relative url to absolute url.

When you start with "/", it starts from your Base URL.

Base URL : "http://example.com/foo/bar" 
Relative URL : /hoge/fuga
Absolute URL: "http://example.com/hoge/fuga"

If you want it to calculate from your start place use without starting "/"

Base URL : "http://example.com/foo/bar" 
Relative URL : hoge/fuga
Absolute URL: "http://example.com/foo/bar/hoge/fuga"

Upvotes: 2

Related Questions