Simple html problem.

Discussion in 'BlackHat Lounge' started by RedKiller, Dec 13, 2012.

  1. RedKiller

    RedKiller Junior Member

    Joined:
    Oct 16, 2010
    Messages:
    183
    Likes Received:
    75
    I have 2 pages on my site.

    on page 1 I have a link to page 2.

    Now, on page 1, I'm linking like this - <a href="http://domain.com/page2">page 2</a>

    page2 is a folder name, in it it have a index.php file.

    Now, I want to link like this instead - <a href="http://../page2">page 2</a>

    instead of .. what I should be putting so that it doesn't need to my domain, like I see some people do <a href="page2.php"> directly but in my case it's a folder, not a file and it's not working.

    What I need to do, I'm noob in programming or html.

    Thanks
     
  2. Oblivion13

    Oblivion13 Regular Member

    Joined:
    Sep 7, 2011
    Messages:
    479
    Likes Received:
    256
    What you would need to do is something like this.

    domain.com/2/index.php

    Then code would be

    <a href="2/index.php>Link Here</a>
     
    • Thanks Thanks x 1
  3. RedKiller

    RedKiller Junior Member

    Joined:
    Oct 16, 2010
    Messages:
    183
    Likes Received:
    75
    Thanks, found on google aswell, what I did was <a href="http://2/index.php>
     
  4. RedKiller

    RedKiller Junior Member

    Joined:
    Oct 16, 2010
    Messages:
    183
    Likes Received:
    75
    Got another small problem,

    page3 is not the sub-folder of page2, when I link from page2 to page3 like this - <a href="page3/index.php"> and when clicking the link in browser, it redirects to domain.com/page2/page3/index.php when the page exist at domain.com/page3/index.php

    What to do in this case.

    Thanks
     
  5. Oblivion13

    Oblivion13 Regular Member

    Joined:
    Sep 7, 2011
    Messages:
    479
    Likes Received:
    256
    add the ../ in there

    so it would be

    <a href="../page3/index.php"> LINK</a>
     
    • Thanks Thanks x 1
  6. artizhay

    artizhay BANNED BANNED

    Joined:
    Nov 21, 2010
    Messages:
    1,868
    Likes Received:
    1,336
    You don't need to do
    HTML:
    <a href="page2/index.php">link</a>
    You could just do
    HTML:
    <a href="page2/">link</a>
    For this, do
    HTML:
    <a href="../page3/">link</a>
    The "../" means go back one folder, so if you're currently in folder "page2," the "../" makes it go back to the root, then goes into folder "page3"
     
  7. Zapdos

    Zapdos Power Member

    Joined:
    Oct 22, 2011
    Messages:
    597
    Likes Received:
    708
    Location:
    Eastern North Carolina
    / = root
    ./ = current directory
    ../ = one directory up.

    If a site was legendary.com and I put a file in with those links (using index.php as file) like such:
    /index.php
    ./index.php
    ../index.php
    The first two would go to the same page. The third would have an error and likely go to the same as the other two.

    If I now made a subdirectory /shop/ and I put a file with those links and file, it would be like this:
    /index.php = goes to legendary.com/index.php
    ./index.php = goes to legendary.com/shop/index.php
    ../index.php = goes to legendary.com/index.php

    Making another directory in that called images it would be like this:
    /index.php = goes to legendary.com/index.php
    ./index.php = goes to legendary.com/shop/images/index.php
    ../index.php = goes to legendary.com/shop/index.php

    Now using the images directory and a new one called /mail/ in the root directory (legendary.com/mail) I can navigate to it using:
    ../../mail/index.php
    OR
    /mail/index.php
     
    Last edited: Dec 13, 2012
  8. artizhay

    artizhay BANNED BANNED

    Joined:
    Nov 21, 2010
    Messages:
    1,868
    Likes Received:
    1,336
    Edit last one to ../
     
    • Thanks Thanks x 1