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

  • SEARCH
  • Home
  • 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 8416047
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T01:37:43+00:00 2026-06-10T01:37:43+00:00

Is it possible to make a relative path to root which would be equally

  • 0

Is it possible to make a relative path to root which would be equally valid from all directories?

I have some documents on the different dir levels, and my relative paths become invalid, if loaded from some other directory.

So if I store my text/html in the db with relative paths they simply won’t work on some pages.

Example of a relative path:

../imgs/my_image.png

Then, if I store full paths as I develop my site, each time I move to new direction, or to an actual production domain from a localhost, all the embedded images (that come from db as text/html) wouldn’t work either.

Example of an absolute path:

127.0.0.1/imgs/my_image.png

So the question is, is it possible without specifying the exact host name, like… pseudocode: %root%/imgs/my_image.png or otherwise some other ways of solving it?

(I mean, without additional server processing of these paths, like using a regex replacing the paths, or creating additional tables to store my pictures, and without moving all the pages into one directory, like happens working with relative paths on CMS sites.)

It honestly bothers me, and I couldn’t think of anything other than additional processing and updating of the records each time it’s needed. But I would like to contribute something I discovered just accidentally.

Even though it did work in modern browsers like Chrome and IE, I totally doubt that this is a correct code. However if I used the highest level relative path to root, it happened to work for lower levels as well.

For example, suppose we have a page like this 127.0.0.1/auth/profile/content/index.php and our image path is 127.0.0.1/imgs/my_image.png, now the following code also worked for the pages on lower levels, e.g. 127.0.0.1/auth/prof.php, and even on the root page itself 127.0.0.1/index.php:

../../../my_image.png

Though logically there is no lower levels on the page in root folder. So I would also like to know some more about it, whether it’s correct or erroneous, and whether we should use such in production…

  • 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-06-10T01:37:45+00:00Added an answer on June 10, 2026 at 1:37 am

    To point to the root of the website from any page under that domain just use /

    So

    http://www.example.com/pages/page.html -> /pages/page.html

    http://www.example.com -> /

    http://www.example.com/a/b/c/d/e/f.png -> /a/b/c/d/e/f.png

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

Sidebar

Related Questions

How can I make my static-file root directories relative to my application root folder
The script have some hard-coded relative paths. I would like them to be relative
Is it possible make some handler that will do something when user shutdown computer
Possible Duplicate: Make iPhone app paid version replace free version on install from app
Is it possible to make it so that a jqGrid will have a width
Is it possible to make .htaccess understand dynamic relative paths and redirect to them
Is it possible to achieve line-height consistency in all browsers? I have attached an
Is it possible to make these relative? for example: webservice.asmx rather then http://servername/webservice.asmx
If I have two folders in localhost: localhost\sites\dog localhost\sites\cat How can I make all
Possible Duplicate: SQL Express Connection string - Relative to application location I have a

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.