SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Nov 2009
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Organizing website folders

    In the past I've placed all my .html files in the same folder on my site, however I've been noticing a bunch of sites that will have a folder on the server with the title of the page. For example, instead of website.com/contact.html it will be website.com/contact. The obvious benefit I can see is simply organizing the site a bit more but I've seen it on sites that don't contain an abundance of pages. Are there there other benefits of setting a site up like this and if so what are they? Also, what's the best practice for creating links to pages in different folders? Would it be using absolute or relative links?

    Thanks!

  2. #2
    Visible Ninja bronze trophy
    JeffWalden's Avatar
    Join Date
    Sep 2002
    Location
    Los Angeles
    Posts
    1,709
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    What you're seeing may be either placing the files in separate directories or it may be SEO friendly URLs. Regardless of what is actually going on, it's generally not a bad idea assuming that you've executed it properly.

    SEO friendly URLs are great for visitors as seeing domain.com/contact makes more sense than domain.com?page=24. They also help search engines, to an extent. Changing your website to SEO friendly URLs isn't going to move you from ranking 150th to 3rd on a particular keyword but it can't hurt.

    SitePoint has a nice article on this: http://articles.sitepoint.com/articl...-friendly-urls

    That being said, I still use directories (and SEO friend URLs) when I'm designing a website. I think it's just nicer to keep things organized. I generally use relative links from the document root. For instance:
    Code:
    <a href="/contact/contact-us.php">Contact Us</a>
    TAKE A WALK OUTSIDE YOUR MIND.

  3. #3
    om nom nom nom Stomme poes's Avatar
    Join Date
    Aug 2007
    Location
    Netherlands
    Posts
    10,233
    Mentioned
    47 Post(s)
    Tagged
    1 Thread(s)
    however I've been noticing a bunch of sites that will have a folder on the server with the title of the page. For example, instead of website.com/contact.html it will be website.com/contact.
    I would say, 99% of the time, they didn't really put the contact.html in its own directory.

    Usually instead, mod_rewrite (or whatever similar thing non-Apache servers use) imitate a directory setup that doesn't actually exist. What's awesome about this is, when you reorganise your site (as someday you likely will), your URLs won't suffer. So if

    /folders/uploades/foo.jpg and all the other images

    gets changed to

    /images/foo.jpg and all the other images (you decide to move them all to a real folder called "images")

    you can have example.com/folders/uploads/any image
    take the user to
    example.com/images/any image

    and you didn't have to worry that visitors after the change would get a 404.

    The article linked above is doing it with PHP. If you are running Apache you can also do it with the server alone: http://articles.sitepoint.com/articl...write-examples
    (also with lighty and some other servers, not sure what you'd do with IIS)


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •