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 4023292
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:34:51+00:00 2026-05-20T10:34:51+00:00

I got a question and although I could find related information, I’m if it

  • 0

I got a question and although I could find related information, I’m if it was exactly about what I’m wondering about.

The thing is, I got a site on http://localhost/site.
Now, when I create a link, let’s say, <a href="/posts">, it links to http://localhost/posts instead of http://localhost/site/posts.
It works fine if I remove the slash (<a href="posts">), that would be the closest and maybe the easiest solution, but I’d like to know why the links ignore the folder where the file is at?

And I also would like to know if this can be fixed with .htaccess or something.

I’ve read that a link that begins with / makes it “absolute”. So a link beginning with / is only intended to be used to link directly to the root, or to be used by sites stored at the root (in this case it wouldn’t make much sense?) ?

  • 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-20T10:34:52+00:00Added an answer on May 20, 2026 at 10:34 am

    The leading ‘/’ at the start of the URL informs the web browser that the path given is absolute (with respect to the web server root), i.e. if you link to /posts then you know that the resulting link will be to http://www.mysite.com/posts.

    If you don’t supply the leading ‘/’ (and you don’t give a complete url like http://www.mysite.com/posts) then usually the url is relative, and any page given will be relatvie to the page currently being viewed.

    For example:

    page being viewed               link url             target page
    ------------------------------------------------------------------------------
    www.mysite.com/site              link.html            www.mysite.com/site/link.html
    www.mysite.com/site              ../link.html         www.mysite.com/link.html
    www.mysite.com/some/other/page   link.html            www.mysite.com/some/other/page/link.html
    www.mysite.com/some/other/page   ../../../link.html   www.mysite.com/link.html
    

    The decision on whether to use absolute or relative links is entirely up to you – the advantage of relative links is that if your site moves, links between pages on your site will still work correctly (for example if your site moves to www.mysite.com/otherpath, then any absolute links such www.mysite.com/originalpath/home will no longer work.

    You should see the following site for a more complete explanation of relative urls:

    • Relative URLs (WebReference.com)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Although I cannot disclose information about the real tables (if I could, I would)
I got question about log4net is it working on IIS 7,5? I read lot
I've got question about wpf xaml style definitions. When I try to set style
This question got me thinking about bare strings. When PHP sees a string that's
This question got me thinking about the max_size method in vector class. It is
I've got a question about self invoking functions in javascript. What I'm doing is
Got a question about using mod_rewrite to redirect specific subdomains to use another domain.
I've got a bit of a tricky question I couldn't find the answer to.
I've got a (hopefully) quick question this time, although it's been troubling me for
Note: This is a sequel to my previous question about powersets. I have got

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.