Is it possible??

Discussion in 'PHP' started by sam1, Jul 16, 2006.

  1. #1
    Actually I want to make web pages with .html extension but still I want that
    they should be parsed by PHP parser. Is it possible??
     
    sam1, Jul 16, 2006 IP
  2. crazyryan

    crazyryan Well-Known Member

    Messages:
    3,087
    Likes Received:
    165
    Best Answers:
    0
    Trophy Points:
    175
    #2
    crazyryan, Jul 16, 2006 IP
  3. ahref

    ahref Well-Known Member

    Messages:
    1,123
    Likes Received:
    67
    Best Answers:
    0
    Trophy Points:
    170
    #3
    In you .htaccess file add this line
    AddType application/x-httpd-php .php .html
     
    ahref, Jul 17, 2006 IP
  4. sam1

    sam1 Active Member

    Messages:
    679
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    58
    #4
    Thanks guys
     
    sam1, Jul 17, 2006 IP
  5. DrMalloc

    DrMalloc Peon

    Messages:
    130
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #5
    It might be a better strategy to use mod_rewrite for this purpose. That way you can detect if the html file exists first, if not it'll try to map it to a php file. I'd worry that there'd be slight slowdowns if every HTML file gets fed to the PHP interpreter instead of being served straight up by apache.
     
    DrMalloc, Jul 18, 2006 IP
  6. phper

    phper Active Member

    Messages:
    247
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    60
    #6
    I think what sam1 wants to achieve is to have files with .html extension to be considered as PHP files. You'd probably want to use mod_rewrite if, for example, the files in the server have .php extension, and you want requests for index.html results in index.php being served. This would mean you'd get the same page if you request for index.html and index.php (both will work), unless of course there are other rewrite rules.

    Also, talking about slowdown, using mod_rewrite can of course also slow down server response.
     
    phper, Jul 18, 2006 IP