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 HTML Basics Going Further with HTML Working on a Website Project Locally

Question about right URL in my bar. For example: not showing the Desktop/project/index.html

Hi all,

What Guil says in the end - that when removing the root paths when working locally on my computer and it should say in my URL bar desktop/project/index.html - doesn't appear on my URL bar.

I have done exactly as Guil says.

Locally I work on Brackets.

Hope to get some help, thanks in advance!

Follow up question: I want to give some screenshots in jpeg for clarification, but see no upload button. How can I show you guys any images of this issue?

Luc de Brouwer
seal-mask
.a{fill-rule:evenodd;}techdegree
Luc de Brouwer
Full Stack JavaScript Techdegree Student 17,939 Points

Can you provide an example of what you are trying to accomplish, I am not 100% certain what you want

whenever I work locally on a website I use WAMP server to display my content instead of right-clicking the .html files open with google chrome or which browser you prefer, then it will provide the entire URL to where the file belongs to, as wherever you use WAMP it will only take localhost/PROJECTMAP/FILENAME.EXTENSION

So if I have a file in C:/Users/Luc/Documents/MyProject index.html

and I open it with google chrome it will provide the entire directory link into the browser url as (WAMP)example:

file:///C:/wamp64/www/myproject/Tips/file.php

Root example:

file:///C:/Users/Luc/Documents/myproject/index.php

Hi Luc,

Thanks for your quick reply. I hope I can get this clear.

When working locally on my computer, In index.html, I don't get an error when I include a forward slash before the article path. It just works fine.

Then clicking the preview button (in Brackets), looking at the URL in the address bar of Google Chrome, the URL shows a bunch of numbers, a colon, some numbers again. Like this:

http://127.0.0.1:49844/articles/2017/article.html

But my rootfolder is this:

file:///Users/B-Groeneveld/Desktop/project/articles/2017/article.html

My questions are how come it's different and why does the link work, though I thought when included a forward slash before the article path, it should give an error?

1 Answer

Luc de Brouwer
seal-mask
.a{fill-rule:evenodd;}techdegree
Luc de Brouwer
Full Stack JavaScript Techdegree Student 17,939 Points

It has something to do with the URI. I have provided two URLs for you that hopefully clarify why this behavior occurs in this situation:

https://stackoverflow.com/questions/27588091/do-browsers-ignore-slashes-in-urls

SO answer: Path separators are defined to be a single slash according to this. (Search for Path Component)

Note that browsers don't usually modify the URL. Browsers could append a / at the end of a URL, but in your case, the URL with extra slashes is simply sent along in the request, so it is the server ignoring the slashes instead. In this case 'localhost' which is your computer

https://superuser.com/questions/352133/why-do-file-urls-start-with-3-slashes

Great, thanks for the help.