E
E
Extramezz2015-06-01 11:38:07
Domain name market
Extramezz, 2015-06-01 11:38:07

How to correctly specify the path from the subdomain to the domain?

There is a site site.ru and its subdomain: name.site.ru
In the root folder of the site is the file img.png
How to specify the path to it from the subdomain? I thought it was like this (but no):
/../img.png

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Denis Ineshin, 2015-06-01
@IonDen

/ is a link to the project root, not the main domain. So the url must be the same as for another domain, i.e. full: site.ru/img/img.png

A
Alexander Lalikin, 2015-06-01
@Lalikin

  1. Hardcode domain address
    site.ru/img.png

    "/../" returns to the directory above.
    for example, if the file is located at site.ru/img.png , then this option will be relevant if the style is located at site.ru/css/main.css
    the server disk does not play a role. Only the url where the files are available is significant.

O
oxxx, 2016-12-02
@oxxx

I don't have an answer, but rather a clarifying question:
There is a site.ru domain, and a m.site.ru subdomain, ...which is physically located in the site.ru/m folder.
In order not to duplicate content, it is necessary that the subdomain "takes" files from the domain.
On the local machine in the subdomain, links like ../images/img.jpg work, but on the server they don't.
The hoster says - write absolute links ( site.ru/images/img.jpg).
In this regard, two questions:
1. how to correctly write a relative path from the subdomain to the domain folder in such a situation (if possible)?
2. Does the load on the server increase when it works with an absolute link instead of a relative one?
(because the hoster says - don't worry, but I don't like this idea)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question