Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML

I can't get my home page to be my parent directory. What do I do?

I'm creating a website for jcpenny when my starts to always end up on index of/ What do I do about this?

Never mind, i learned that the "i" in "index.html" should have been lowercased

2 Answers

Hi Garrett,

I think I understand your question, but I will re-write just incase.

You are building a website and want the homepage to be the url without the page name at the end?

Like: www.jcpenny.com not: www.jcpenny.com/home.html

This depends greatly on the language you are using and the setup of your server. You can change the default page in your server settings.

HTML

index.html

PHP

index.php

ASP VB

default.asp

You need to do some routing on the server side. There are courses in Treehouse about that topic for every language.

Routing means basically to provide a file to the client (HTML or PHP) after a http request is made to the server with a certain route.

for example when you have http://www.yourwebsite.com/, your route is the last "/" (the "root" route). then the server must have a route function that says (in pseudocode):

if (http get-request with route "/"){ render(somefile.html) }

I hope it's clear enough.

You shouldn't need to do that for 'index.html' though as this is 99% the default? But if you wanted your root level to use 'home.html' you could use this.

This is helpful for url rewriting though, good info. :)

I corrected the answer... I doesn't have to be "index.html". It can be any file you want ("somefile.html"). Thanks Damien Watson for the comment

Yeh, cool. :)