Tutorial: Treat HTML files as PHP ones

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Tutorial: Treat HTML files as PHP ones

    This tutorial is for medium level users.



    Yesterday, I downloaded a free flash template from internet, and I directly faced a problem. The template had this structure:

    index.html
    text.html
    flashfile.swf
    images/

    As you may understand, all the content used for menu and for pages was stored into the text.html as a normal text document, but I wanted that the content into the website to be dynamic (updating pages from database). But, changing from text.html to text.php will not do the job as the flash file will request for text.html and will not find it.

    So, I thought for a way of "manipulating" the text.html to be treated as text.php but still remains text.html in the flashfile.swf's eyes. Adding this short code into .htaccess parallel with other files will do the job:

    Code:
    AddHandler x-httpd-php .html .htm .php
    But now the new servers will need this code:

    Code:
    AddHandler application/x-httpd-php .html .htm .php
    or

    Code:
    AddType application/x-httpd-php .html .htm .php
    The above case it's just one of many others you may need to do this. Another case may be if you have a big site in html, and you want to convert it into a database driven one, but renaming files from .html to .php will just cause loose of visitors, because they have stored your pages as bookmarks as .html.

    Hope it was helpful for you and you will know to manage it in your own interes.
    mysterio.al - programming is a functional art

    #2
    not only html ,people can use their own extension too like exe,asp!! 2 years ago i used this tricks to use jsp script as php.Now my server updated ,they added suphp and disabled .htaccess .but php.ini still support. php.ini sucks i can't edit it .do you know any way to use this tricks with php.ini?


    P.s:remember if ur server not support this features in htaccess people will not see ur page as script, they will see it as a downloadable file!!most of time urscriptname.data file!! I lost my many source code lol
    PHP Code:
    /* I don't know everything hehe */ 
    Find me on facebook

    Comment

    Working...
    X