LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-03-2010, 01:45 AM   #1
LinpusKelvin
Member
 
Registered: May 2010
Posts: 39

Rep: Reputation: 15
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!!
 
Old 06-03-2010, 01:55 AM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
A URL like "/data/websites/index.html" is with respect to your server's logical DocumentRoot, not a physical location on your hard drive.
 
0 members found this post helpful.
Old 06-04-2010, 10:53 AM   #3
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
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!
 
1 members found this post helpful.
Old 06-04-2010, 10:08 PM   #4
LinpusKelvin
Member
 
Registered: May 2010
Posts: 39

Original Poster
Rep: Reputation: 15
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
 
Old 06-05-2010, 01:11 AM   #5
mikewc02
LQ Newbie
 
Registered: Jan 2010
Location: St. Louis, MO
Distribution: Arch Linux
Posts: 12

Rep: Reputation: 3
Where is the .gif image located? Do you have file permissions set appropriately? (i.e. Readable by all?)
 
Old 06-05-2010, 02:25 AM   #6
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
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
 
Old 06-05-2010, 06:05 AM   #7
Andrew Benton
Senior Member
 
Registered: Aug 2003
Location: Birkenhead/Britain
Distribution: Linux From Scratch
Posts: 2,073

Rep: Reputation: 64
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 /
 
Old 06-05-2010, 10:31 AM   #8
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
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.
 
1 members found this post helpful.
Old 06-06-2010, 02:21 AM   #9
LinpusKelvin
Member
 
Registered: May 2010
Posts: 39

Original Poster
Rep: Reputation: 15
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
 
Old 06-06-2010, 06:19 PM   #10
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
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.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Merge Of Html Files Into A Single Html (or Pdf) fiomba Linux - Software 10 05-11-2018 11:28 AM
basic html question - download link to files on my webpage question Davno Linux - Server 5 12-25-2009 07:24 AM
How to create symbolic link to html file and avoid page link problem? haxpor Linux - General 2 01-29-2008 07:40 AM
html code and including html files Hockeyfan Programming 2 08-22-2005 05:11 PM
How can I create a link to a folder that shows hidden files? Mubli Linux - Newbie 2 06-04-2004 07:36 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:59 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration