Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS HTML help!!

  • This topic is empty.
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #36621
    Ricardo C.
    Participant

    How do I code in order to get something as the following: http://www.xxxxx.com/xxxxx/xxxxx
    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.

    #96588

    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.

    #96589
    SgtLegend
    Member

    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.

    #96591

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

    #96592
    SgtLegend
    Member

    @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:

    /user/account/edit-profile

    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.

    #96593

    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.

    #96603
    SgtLegend
    Member

    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:

    /user/edit
    /user/login
    /user/log-out
    /user/sign-up

    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.

    #96604

    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 ;)

    #96628
    Ricardo C.
    Participant

    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)
  • The forum ‘CSS’ is closed to new topics and replies.