Simple html problem.

RedKiller

Junior Member
Joined
Oct 16, 2010
Messages
183
Reaction score
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
 
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>
 
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, found on google aswell, what I did was <a href="http://2/index.php>
 
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
 
You don't need to do
HTML:
<a href="page2/index.php">link</a>
You could just do
HTML:
<a href="page2/">link</a>
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
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"
 
/ = 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:
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
Edit last one to ../
 
Back
Top