SitePoint Sponsor

User Tag List

Results 1 to 11 of 11
  1. #1
    SitePoint Addict
    Join Date
    Feb 2006
    Posts
    313
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    .php ext renaming to .html

    Hi,

    When looking around sites like amazon you can never see a .php .asp extension but .html is used. Is there any reason why the server side script extension is not used?

    I ask as i was wondering whether to apache mod_rewrite php to html on all pages.

    Regards
    p_h_p

  2. #2
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    amazon is extentionless. When I quickly looked thought it.
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.


  3. #3
    SitePoint Wizard
    Join Date
    Apr 2002
    Posts
    2,307
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by p_h_p View Post
    Hi,

    When looking around sites like amazon you can never see a .php .asp extension but .html is used. Is there any reason why the server side script extension is not used?

    I ask as i was wondering whether to apache mod_rewrite php to html on all pages.

    Regards
    p_h_p
    there's a simple apache command you can put in your .htaccess file which says in english "treat the following extension types as php:....". i forget what that command is off the top of my head. so basically you can make .html files get parsed and treated as if they were .php files.

    but have you also noticed, and don't you also think, that for web pages no extension is far more desirable than any extension? what purpose, from site visitor's point of view (which is the one that matters), does .html or .php or .anything on the end of an url serve? none imo.

  4. #4
    SitePoint Wizard stereofrog's Avatar
    Join Date
    Apr 2004
    Location
    germany
    Posts
    4,324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by p_h_p View Post
    Is there any reason why the server side script extension is not used?
    Imagine one day you decide to abandon php and switch to another platform. Renaming all your files from php to, say, "jsp" would be horrible, much better is to rewrite "foo.html" (or simply "foo") to whatever backend script you use.

    Quote Originally Posted by johnyboy View Post
    what purpose, from site visitor's point of view (which is the one that matters), does .html or .php or .anything on the end of an url serve? none imo.
    It points to the difference between "file" and "directory", but yes, for most resources this doesn't matter much.

  5. #5
    rajug.replace('Raju Gautam'); bronze trophy Raju Gautam's Avatar
    Join Date
    Oct 2006
    Location
    Kathmandu, Nepal
    Posts
    4,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes I think this is because of apache's mod_rewrite features which i want to learn and implement in all the sites.
    Mistakes are proof that you are trying.....
    ------------------------------------------------------------------------
    PSD to HTML - SlicingArt.com | Personal Blog | ZCE - PHP 5

  6. #6
    SitePoint Wizard
    Join Date
    Apr 2002
    Posts
    2,307
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by johnyboy View Post
    there's a simple apache command you can put in your .htaccess file which says in english "treat the following extension types as php:....". i forget what that command is off the top of my head
    Code:
    AddType application/x-httpd-php .php .html
    in your .htaccess file makes .html files and .php files get parsed by the php parser/executer/whatever it's called

    but mod rewrite is a, and probably the, way to go for extensionless urls

  7. #7
    Team SitePoint santouras's Avatar
    Join Date
    Jul 2006
    Location
    planet earth
    Posts
    276
    Mentioned
    16 Post(s)
    Tagged
    0 Thread(s)
    I'm personally against using AddType to send .html files through php. It creates an overhead when you want to process straight html as the php executable is loaded to essentially do nothing. I like to use mod_rewrite to send all non files through php which allows me to do extensionless, seo friendly url's
    my utility belt tells me its to the bar batman

    read the manual then google it then do a search THEN post....

  8. #8
    SitePoint Addict
    Join Date
    Feb 2006
    Posts
    313
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi thanks for everyones input.

    The only problem i have with extensionless urls is that i will have loads of hrefs to change but then thats life.

    amazon does use .html for some pages although like previously said they use extensionless urls. Is this entirely for seo or does giving away the programming language help hackers in anyway, i wouldn't have thought it does though.

    p_h_p

  9. #9
    Team SitePoint santouras's Avatar
    Join Date
    Jul 2006
    Location
    planet earth
    Posts
    276
    Mentioned
    16 Post(s)
    Tagged
    0 Thread(s)
    its more that when you start doing dynamic urls there's just not a lot of point to putting an extension on the end. Its not like that file exists on the server anyway, so its basically pointless
    my utility belt tells me its to the bar batman

    read the manual then google it then do a search THEN post....

  10. #10
    SitePoint Addict
    Join Date
    Feb 2006
    Posts
    313
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok so i should not rewrite all urls just the excessively long ones and those with variables attached even though all data from the url is verified before being use (for example looking for sql injection attempts).

    p_h_p

  11. #11
    SitePoint Wizard silver trophybronze trophy Stormrider's Avatar
    Join Date
    Sep 2006
    Location
    Nottingham, UK
    Posts
    3,133
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Basically, it is a very basic security thing, and also because if you are using mod_rewrite anyway, there is no point in having the extension on, as someone said.

    By hiding the extension, you are hiding what technology the site uses to some extent, and just adds that extra tiny bit of security.

    Another way is to simply say that html pages should be sent to the php interpreter for processing, which can be done with apache and .htaccess. Or, .asp pages, or .php pages processed as ASP, whatever you want.


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
  •