LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to link files in different folder in html (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-link-files-in-different-folder-in-html-811863/)

LinpusKelvin 06-03-2010 01:45 AM

How to link files in different folder in html
 
I try to link two page from different folder and directory

1. I want to link file:///data/websites/index.html to the mainpage http://localhost:8000/server/index.html.

2. I used this code in html onclick="location.href='/data/websites/index.html'"

3. Nothing was shown.

4. Pls help me YA!!

paulsm4 06-03-2010 01:55 AM

A URL like "/data/websites/index.html" is with respect to your server's logical DocumentRoot, not a physical location on your hard drive.

paulsm4 06-04-2010 10:53 AM

What part of "DocumentRoot" don't you understand?
 
LinpusKelvin -

do you understand the difference between a filepath on the *server* (where "/" is your server's "DocumentRoot") or a filepath on your web browser *client* (where "file:" points to something on your local hard drive)?

If you need clarification, ASK!

LinpusKelvin 06-04-2010 10:08 PM

Settled but gt some problems
 
1. I make a link of the folder and sent it to the server folder.
2. Then, the problem is the html cannot view the GIF format picture.

thanks

mikewc02 06-05-2010 01:11 AM

Where is the .gif image located? Do you have file permissions set appropriately? (i.e. Readable by all?)

paulsm4 06-05-2010 02:25 AM

Hi -

Quote:

I make a link of the folder and sent it to the server folder.
Q: Do you mean you made a symbolic link (e.g. "ln -s")?

Q: Did you specify "SymLink" in your httpd.conf file?

Q: Do you know what I mean?

I'm serious: if you don't understand something, please ASK. Don't just mark the post "not helpful", and move on.

Similarly, when the problem is resolved, please mark the post "Resolved", and tell us exactly what you did to solve the problem. That way others can learn from your experience.

IMHO .. PSM

Andrew Benton 06-05-2010 06:05 AM

There are 2 ways you can link to the second page, either with the absolute url (eg href="http://some/web/address") or with a relative path (eg href="../images/picture.png"). The relative path is relative to the page with the link in it. .. goes up one folder. ../images goes up one folder then into the images folder. data/websites/index.html points to the file index.html inside the folder websites inside the folder data, all relative to the current directory. If you put a / at the front of the path it becomes an absolute path relative to the root folder /

paulsm4 06-05-2010 10:31 AM

LinpusKelvin -

This is all absolutely correct:
Quote:

There are 2 ways you can link to the second page, either with the absolute url (eg href="http://some/web/address") or with a relative path (eg href="../images/picture.png"). The relative path is relative to the page with the link in it. .. goes up one folder. ../images goes up one folder then into the images folder. data/websites/index.html points to the file index.html inside the folder websites inside the folder data, all relative to the current directory. If you put a / at the front of the path it becomes an absolute path relative to the root folder /
... BUT ...

1. The term "link" has two meanings.
a) If you mean an HTML "link", the above is true.
b) If you mean an OS "link" (as in "ln -s", for example)
... then while the above is still true
... it might not work UNLESS you allow "Follow symbolic links" in your http.conf file

2. If you mean HTML "link"
... then the path is NOT the physical path on your server's hard drive
Rather, the root ("/") is the "DocumentRoot" you specified in your httpd.conf file. The relative path is with respect to your "DocumentRoot".

Make sense?

Does it help with the problem?

Please keep us posted.

LinpusKelvin 06-06-2010 02:21 AM

hi all,

Thanks for the reply. The folder I linked is by right clicking on the icon and select the link function. Then, the link folder was sent to the server folder.

1. Paul, it is a HTML link
2. What is httpd.conf then, can explain it briefly to me. Thanks first
3. The problem that I m facing now is some webpages with GIF images cannot be shown in the web browser.
4. My specification of PC: centOS 5.4, mozilla firefox 2.6, and mozilla is without JAVA support.

Thanks in advance

paulsm4 06-06-2010 06:19 PM

Hi -

"httpd.conf" is the main Apache server configuration file.

All this time, I've been trying to say:

1. I believe your problem is on the server side

2. It's essential to familiarize yourself with how the server works (including the concept of "DocumentRoot") in order to resolve the problem

This link might help:

http://www.centos.org/docs/5/html/De.../ch-httpd.html

Please scan through it, and post back any specific questions you might have.


All times are GMT -5. The time now is 11:43 PM.