Links as Directories

Discussion in 'PHP' started by audax, Jan 18, 2007.

  1. #1
    I just had a few questions about links on pages being directories. For example, say I want to set up my site to have a Contact page, the URL to that page being either:

    www.mysite.com/index.php?page=contact
    or:
    www.mysite.com/contact.php

    But I'm seeing a lot of links now that are just links to directories, for example, the contact page above would instead just link to a directory, thus:

    www.mysite.com/contact

    Check out the links on the right side of the page for this website as an example: http://textpattern.com/

    Notice that none of the links have filename extensions and are instead directories/subdirectories. Why is this?
    What are the pros & cons of doing something like this? And how would you do it? Would you have to create an index page for each of the directories, even if you just wanted to change the content on the page and not the universal layout?
     
    audax, Jan 18, 2007 IP
  2. sarahk

    sarahk iTamer Staff

    Messages:
    28,827
    Likes Received:
    4,541
    Best Answers:
    123
    Trophy Points:
    665
    #2
    From a browser point of view it just asks for the default page in the directory (ie index.php)

    From a search engine point of view I doubt there is any difference
     
    sarahk, Jan 18, 2007 IP
  3. audax

    audax Peon

    Messages:
    83
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    So you would have to create an index page for each directory? Then what's the point when you can just have one universal index page and change its content by using GET to change what it include()'s?
     
    audax, Jan 18, 2007 IP
  4. sarahk

    sarahk iTamer Staff

    Messages:
    28,827
    Likes Received:
    4,541
    Best Answers:
    123
    Trophy Points:
    665
    #4
    They'll often (normally?) be using .htaccess to fudge the fact that they are, infact, all running through the one index.
     
    sarahk, Jan 18, 2007 IP
  5. peaforabrain

    peaforabrain Active Member

    Messages:
    45
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    63
    #5
    Do a search for 301 mod rewrite. Its a function that lets you rewrite variable strings into 'pretty url's'.

    It's easy to set up, if you are on an Apache host within the .htaccess file.
     
    peaforabrain, Jan 19, 2007 IP
  6. audax

    audax Peon

    Messages:
    83
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Would it, however, actually change where that link is pointing to?

    If I say used mod_rewrite to change:
    www.mysite.com/contact.php
    to:
    www.mysite.com/contact

    Would there be a conflict with there not being any "/contact" directory? And would you have to do it for every page?
     
    audax, Jan 22, 2007 IP