IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> How To Create/link To Pages In Subdirectories?
NikMac
post Nov 3 2009, 02:33 AM
Post #1


Newbie
*

Group: Members
Posts: 10
Joined: 25-September 09
Member No.: 34,054



This is something that should be simple, but it's becoming a pretty big obstacle for me.

I want to link to www.example.com/lessons/lessons.html when someone goes to www.example.com/lessons . I put the folder "lessons" into my root folder, and "lessons.html" in the "lessons folder". However, when I link to "<a href="/lessons/lessons.html"> or "<a href="./lessons/lessons.html"> I get a 404 error. What am I doing wrong?

Thanks.
Go to the top of the page
 
+Quote Post
chibineku
post Nov 3 2009, 02:54 AM
Post #2


Invested Member
***

Group: Members
Posts: 928
Joined: 18-March 09
From: EK, Scotland
Member No.: 29,495
Languages: (X)HTML, CSS, JavaScript, PHP, MySQL [all are in their infancy!]



Is there also a copy of lessons.html in the root folder? Perhaps as a mistaken upload? I have found that that can cause problems with mod_rewriting, as the server tries to resolve the document first if it can.
Go to the top of the page
 
+Quote Post
thescientist
post Nov 3 2009, 03:41 AM
Post #3


Likes gettin' it on!
***

Group: Members
Posts: 643
Joined: 24-May 08
From: Rhode Island, USA
Member No.: 22,266
Languages: (X)HTML, CSS, Javascript, PHP/MySQL, XML, Java (still gettin a grip on those last couple)



it must just be a typo...
Go to the top of the page
 
+Quote Post
NikMac
post Nov 5 2009, 01:11 AM
Post #4


Newbie
*

Group: Members
Posts: 10
Joined: 25-September 09
Member No.: 34,054



Yes - it must have been some sort of typo as the link is working now.

However, I still don't know how to make "www.example.com/lessons/" link to "/lessons/lessons.html". Right now that just points me to an ftp-like "index of file:///..." page. How do I make this work?

Thanks.
Go to the top of the page
 
+Quote Post
thescientist
post Nov 5 2009, 01:44 AM
Post #5


Likes gettin' it on!
***

Group: Members
Posts: 643
Joined: 24-May 08
From: Rhode Island, USA
Member No.: 22,266
Languages: (X)HTML, CSS, Javascript, PHP/MySQL, XML, Java (still gettin a grip on those last couple)



if you are just trying to link to a file within the folder you are working in, all you have to do is just link to the page, i.e. lessons.html

You can always just write out the whole url just to be sure, www.example.com/lessons/lessons.html

This post has been edited by thescientist: Nov 5 2009, 01:44 AM
Go to the top of the page
 
+Quote Post
NikMac
post Nov 5 2009, 01:52 AM
Post #6


Newbie
*

Group: Members
Posts: 10
Joined: 25-September 09
Member No.: 34,054



QUOTE (thescientist @ Nov 4 2009, 06:44 PM) *
if you are just trying to link to a file within the folder you are working in, all you have to do is just link to the page, i.e. lessons.html

You can always just write out the whole url just to be sure, www.example.com/lessons/lessons.html


I've figured that bit out - but how do I make it so that when a visitor types "www.example.com/lessons", they are redirected to the lessons.html page, and not an ftp or 404 page?
Go to the top of the page
 
+Quote Post
Synook
post Nov 5 2009, 02:31 AM
Post #7


53 79 6E 6F 6F 6B 0D 0A
*****

Group: Members
Posts: 4,750
Joined: 14-July 07
From: Australia
Member No.: 15,617
Languages: (X)(HT)ML, CSS, PHP, SQL, JavaScript, Java (a bit)



When a directory itself is requested, the web server will look for certain files, usually index.html or similar, and display that. If you want lessons.html to appear instead, either rename it index.html, create a symbolic link pointing from index.html to lessons.html, use a URL rewriting module to change lessons/ to lessons/lessons.html, or create a new index.html page that redirects to lessons.html.
Go to the top of the page
 
+Quote Post
NikMac
post Nov 5 2009, 02:52 AM
Post #8


Newbie
*

Group: Members
Posts: 10
Joined: 25-September 09
Member No.: 34,054



QUOTE (Synook @ Nov 4 2009, 07:31 PM) *
When a directory itself is requested, the web server will look for certain files, usually index.html or similar, and display that. If you want lessons.html to appear instead, either rename it index.html, create a symbolic link pointing from index.html to lessons.html, use a URL rewriting module to change lessons/ to lessons/lessons.html, or create a new index.html page that redirects to lessons.html.


Thanks - what is the best way to go with? Would there be any disadvantages to calling it "index.html" (as then I would have at least two "index.html" pages in my site).

How do I create a "symbolic link" or "url rewriting module"? - or make a "new index.html page that redirects to lessons.html".
Go to the top of the page
 
+Quote Post
Synook
post Nov 5 2009, 03:49 AM
Post #9


53 79 6E 6F 6F 6B 0D 0A
*****

Group: Members
Posts: 4,750
Joined: 14-July 07
From: Australia
Member No.: 15,617
Languages: (X)(HT)ML, CSS, PHP, SQL, JavaScript, Java (a bit)



QUOTE
Would there be any disadvantages to calling it "index.html" (as then I would have at least two "index.html" pages in my site).

Each directories should have an index page, so that people don't end up seeing the folder listing.

QUOTE
How do I create a "symbolic link" or "url rewriting module"? - or make a "new index.html page that redirects to lessons.html".

You can rewrite the URL using, for example on Apache, mod_rewrite. A symlink is a "virtual" file that really points back to the other one, like a link, and can be created using the ln command (UNIX only).

You can redirect server-side or client side, on the server-side you can send a Location: header, e.g. (in PHP)
CODE
<?php
    header("location:lessons.html");
?>
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 23rd November 2009 - 06:52 AM