Treehouse: Grow your CSS skills. Land your dream job.

HTML help!!

  • # February 12, 2012 at 2:55 pm

    How do I code in order to get something as the following:
    after the domain name the forward slashes? Hope my question make sense to those who are reading it. Any sort of help will be much appreciated. Thanks in advance.

    # February 12, 2012 at 5:08 pm

    The typical way to do it is to use a folder structure, where xxx is the name of the folder, and then you have index.html in the final folder.

    # February 12, 2012 at 5:12 pm

    The way this is typically done these days is by using the mod_rewrite module in Apache and a .htaccess file, creating sub-folder after sub-folder can lead to problems updating code or page structuring where as a .htaccess file allows you to create a virtual URL that points to a real file.

    # February 12, 2012 at 5:46 pm

    @SgtLegend Out of curiosity, what are the actual problems with the good old folder setup? I have never heard of any problems myself.

    # February 12, 2012 at 6:59 pm

    @joshuanhibbert – I’m not saying there is anything wrong with it in general but the underlying problems are that if you have a folder structure such as the following:


    Your creating a redundant folder structure which is harder to maintain because of the deep linking process your trying to use, the advantage of mod_rewrite is you can keep the same link but have the file it reports to within a single folder that is easy to manage and update.

    Another advantage of mod_rewrite is you don’t have to update any folder names as if you change a URL you can simply use a RewriteRule to redirect users from the old URL to the new one without ever having to create a new folder and such.

    # February 12, 2012 at 7:07 pm

    Oh, right. I misunderstood. And I agree 100%; that’s how I prefer to do it too. Rather than having /user/account/edit-profile/index.html you just have /user/account/edit-profile.html and use .htaccess to hide the extension.

    As you can probably tell, I know very little in regards to messing about with .htaccess.

    # February 12, 2012 at 10:34 pm

    Sorry to highjack your thread ricky122892

    The way i normally structure rewrite rules is based on the controller and method i want to target, for instance using your above example instead of continuing to call a .html file that’s based on the original name i would do the following:


    Of course in the end it’s a personal preference but i tend to follow MVC standards which are again based of a controller and method pattern, a great example of this in action is the Symfony framework which makes great use of custom URL’s based off two arguments given in the routing table.

    # February 12, 2012 at 10:55 pm

    Heh, that might as well have been in gibberish. I’m a front-end dev so I leave that sort of stuff to people who know what they are talking about ;)

    # February 13, 2012 at 12:13 pm

    No need for apologies, for I learned i gained knowledge from your conversation also learn from , though I do very much appreciate the both of you for your advice, thank you very much, best regards to the both of you

Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.