#1
  1. A Change of Season
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2004
    Location
    Next Door
    Posts
    2,653
    Rep Power
    171

    How is it that Devshed pages have .html extension?


    Pages like this are obviously php. How is that they are .html?
  2. #2
  3. Mad Scientist
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Oct 2007
    Location
    North Yorkshire, UK
    Posts
    3,661
    Rep Power
    4123
    A web server (eg apache) can be configured to handle any file name/type any way the developer likes.

    So the sysadmins of devshed just tell their webserver to parse .html pages through the php engine

    simple as that really.

    Another way of doing this is to not use real pages at all and do url rewriting, essentially passing the whole request to a php script. This can be done with an .htaccess rewrite rule for apache:

    Code:
    RewriteEngine On
    RewriteBase /
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

    lets say we have a URL of http://www.example.com/products/blue-widget.html

    and that http://www.example.com/index.php falls under the above configuration, then

    if the file /products/blue-widget.html does not exist then the REQUEST PHP gets is

    http://www.example.com/index.php?q=products/blue-widget.html

    so you can see that scripting in php (a cms, for example) then parses $_GET['q'] to work out what content to serve. PHP can then serve a 200OK header or a 404 not found if the content is not found.

    This blurs the lines a little between the roles of the web server and the pre-processor but the end result is just the same
    I said I didn't like ORM!!! <?php $this->model->update($this->request->resources[0])->set($this->request->getData())->getData('count'); ?>

    PDO vs mysql_* functions: Find a Migration Guide Here

    [ Xeneco - T'interweb Development ] - [ Are you a Help Vampire? ] - [ Read The manual! ] - [ W3 methods - GET, POST, etc ] - [ Web Design Hell ]
  4. #3
  5. Sarcky
    Devshed Supreme Being (6500+ posts)

    Join Date
    Oct 2006
    Location
    Pennsylvania, USA
    Posts
    10,853
    Rep Power
    6351
    It's actually mod_rewrite (or equivalent), there are no html pages on devshed. The URL you presented contains the thread ID and the thread title, then .html at the end simply to look like what web addresses looked like back in 1998 when devshed made that decision.
    HEY! YOU! Read the New User Guide and Forum Rules

    "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin

    "The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002

    Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.
  6. #4
  7. Mad Scientist
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Oct 2007
    Location
    North Yorkshire, UK
    Posts
    3,661
    Rep Power
    4123
    For example this page is

    http://forums.devshed.com/php-development-5/how-is-it-that-devshed-pages-have-html-extension-944142.html

    but can also be accessed at

    http://forums.devshed.com/-5/-944142.html
    I said I didn't like ORM!!! <?php $this->model->update($this->request->resources[0])->set($this->request->getData())->getData('count'); ?>

    PDO vs mysql_* functions: Find a Migration Guide Here

    [ Xeneco - T'interweb Development ] - [ Are you a Help Vampire? ] - [ Read The manual! ] - [ W3 methods - GET, POST, etc ] - [ Web Design Hell ]
  8. #5
  9. Did you steal it?
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    13,996
    Rep Power
    9397
    ^ is how I got lots of links in my sig: the full versions are (were?) too long to fit.

    On top of that, the forum ID doesn't actually matter when linking to threads: http://forums.devshed.com/-/-944142.html works fine too.
  10. #6
  11. Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jan 2004
    Location
    New Springfield, OH
    Posts
    1,214
    Rep Power
    1469
    The "thread" VBCode makes it even shorter.
    Don't like me? Click it.

    Scripting problems? Windows questions? Ask the Windows Guru!

    Stay up to date with all of my latest content. Follow me on Twitter!

    Help us help you! Post your exact error message with these easy tips!

IMN logo majestic logo threadwatch logo seochat tools logo