Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 588305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:18:16+00:00 2026-05-13T15:18:16+00:00

I am writing a html file under ~/public_html on our server. I would like

  • 0

I am writing a html file under ~/public_html on our server. I would like to refer to other files under ~/public_html in the html file. I now only know how to specify the path to those files (like pictures) via relative path from the html file. But I would like to know if there is a way to specify the absolute path? Because sometimes I will move the html file under ~/public_html, so the relative path from the html file to those files might not hold any longer.

Thanks and regards!


Update:

Thanks! I still not quite get how to do it. For example,

if on the linux server, I have ~/public_html/doc/doc1.html and ~/public_html/pic/pic1.jpg. I would like to refer to pic1.jpg in the doc1.html. I can just write “../pic/pic1.jpg”. How I can access doc1.html from outside via link http://www.xxx.xxx/~tim/doc/doc1.html and the picture can be loaded correctly.

But if later I move doc1.html to ~/public_html/doc_old/doc1.html, the relative path from doc1.html to pic1.jpg will not hold any longer. I just wonder if I could specify some absolute path for pic1.jpg in doc1.html for external accessing?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T15:18:16+00:00Added an answer on May 13, 2026 at 3:18 pm

    An absolute path can be specified by beginning the path with a forward slash (/). This will allow you to refer to documents underneath your document root.

    Here is a link to an article on absolute vs. relative paths in HTML.

    Edit: in response to your update – the reason you can access pic1.jpg as ../pic/pic1.jpg from doc1.html is that doc1.html lives in /doc/, so moving up one directory and then down into pic will bring you to pic1.jpg. Similarly, since your document root is ~/public_html/, you can access pic1.jpg as /pic/pic1.jpg from any html file. /pic will be interpreted as ~public_html/pic/.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing an iPhone app with a UIWebView which should display various html files
I'm writing entries for cross-browser bugs/workarounds. I would like the main view to present
I am writing html content to a BML file, how can I remove new
I'm writing a Winforms application and I've been writing these awful HTML reports where
Let's face it: writing proper, standards compliant HTML is quite difficult to do. Writing
Writing something like this using the loki library , typedef Functor<void> BitButtonPushHandler; throws a
Lets say you have lots of html, css, js, img and etc files within
For the longest time now I've been trying to convert HTML pages containing large
i'm writing a servlet that receives a xml file, gives it to another class
I am writing a gem which provides helpers for views. The HTML I want

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.