Forums

using "./" in href interpreted as one navigational level up as opposed to root (3 posts)

  1. drekonus
    Member
    Posted 1 year ago #

    My question is how to have "./" interpreted correctly using when using custom permalinks option /%postname%/ ?

    I'm using apache 2.2 and in wordpress, the permalinks custom option with /%postname%/ and it is correctly generating the navigation and page urls. However it seems the "./" in my href links is being interpreted relative to the page I am linking from (currently viewing) as opposed to the document or site root. For example if I am on the history page under the about section of the site:

    http://localhost/about/history

    and I have a link in the content to navigate from the history page to the staff page:

    link to staff page

    the "./" is being interpreted as "http://localhost/about" as opposed to just "http://localhost" where, when mousing over the link it reads:

    http://localhost/about/about/staff

    Same happens if I try to create a link to another part of the site. from this same history - http://localhost/about/history - page:

    link to staff page

    the "./" is interpreted as:

    http://localhost/about

    thus making the link read on mouse over:

    http://localhost/about/news/articles"

    as opposed to

    http://localhost/news/articles"

    What need be done to get that "./" to be interpreted as the top level wordpress directory as opposed to it being interpreted as one navigational level above the currently viewed document?

  2. Joseph
    Member
    Posted 1 year ago #

    Root directory is just a slash, no dot. "./" means relative to the current directory.

    See http://www.webreference.com/html/tutorial2/3.html

  3. drekonus
    Member
    Posted 1 year ago #

    I know what you're thinking, as I thought the same thing and tried that long time ago. Problem was that if to use just the slash "/", the absence of the dot causes the link to be measured down from the current page. I understand what you're saying, and I tried that where, if in the http://localhost/about/staff, I have a link using:

    href="/news/articles"

    the link is then interpreted as

    "http://localhost/about/staff/news/articles"

    where again the beginning of the url, the "/", is being interpreted not as "http://localhost" but rather "http://localhost/about/staff".

    I am pretty sure this has some to do with a combination of my apache configuration files and what wordpress is actually doing under the covers to implement permalinking using "/%postname%/"

Topic Closed

This topic has been closed to new replies.

About this Topic