HTML to be run as PHP

Discussion in 'Apache' started by springlink, Dec 12, 2009.

  1. #1
    Hi,

    I would like to ask you, if you can help me with this:

    I have PHP website with URL structure as www.domain.com/blue-cars.PHP

    and I need to do the following:

    when I type in browser www.domain.com/blue-cars.HTML then I would like the URL blue-cars.PHP to be run, but shown as blue-cars.HTML in the browser - to the visitor and also to the bots.

    also the sitemap and all navigations should have visible URLs with .HTML , but their .PHP versions should be run (execute)...

    how can I do this?
    (I suppose using htaccess ? but how?)

    thanks for you help! :eek:
     
    springlink, Dec 12, 2009 IP
  2. Grit.

    Grit. Well-Known Member

    Messages:
    1,424
    Likes Received:
    22
    Best Answers:
    1
    Trophy Points:
    110
    #2
    Grit., Dec 12, 2009 IP
  3. fierceservers

    fierceservers Peon

    Messages:
    338
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Put this in your .htaccess file:
    Then add the following to "blue-cars.HTML", inserting this where you want to include the PHP file:
     
    fierceservers, Dec 12, 2009 IP
  4. springlink

    springlink Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    for fierceservers - wow! thanks, it works! :)
     
    Last edited: Dec 12, 2009
    springlink, Dec 12, 2009 IP
  5. springlink

    springlink Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    for Grit. - thank you for your answer :)
     
    Last edited: Dec 12, 2009
    springlink, Dec 12, 2009 IP
  6. springlink

    springlink Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Hi!

    I did what you wrote (see bellow) - it works perfect in Firefox and Opera browsers, but MS Explorer 8 does not show the page correctly - the segments are mixed up on the page - I tried to fix this issue for several days, but no success... somebody can help?
    thanks! :)

    Put this in your .htaccess file:
    Quote:AddType application/x-httpd-php .html

    Then add the following to "blue-cars.HTML", inserting this where you want to include the PHP file:
    Quote:<?php include ("blue-cars.php");?>
     
    Last edited: Dec 18, 2009
    springlink, Dec 18, 2009 IP
  7. fierceservers

    fierceservers Peon

    Messages:
    338
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #7
    This is most likely an IE issue versus anything to do with what you added to .htaccess. Whatever that PHP file is outputting might have display issues in IE if being included in another page.
     
    fierceservers, Dec 18, 2009 IP
  8. springlink

    springlink Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    thanks for your reply, I have added this to htaccess:

    AddType application/x-httpd-php .html

    and then I have index.php included in index.html using this: <?php include ("index.php");?> IT GIVES ME PHP OUTPUT when I write to browser index.html - IT WORKS GREAT IN OPERA AND FIREFOX, BUT NO EXPLORER 8...

    :-(
     
    springlink, Dec 18, 2009 IP
  9. chandan123

    chandan123 Prominent Member

    Messages:
    11,586
    Likes Received:
    578
    Best Answers:
    0
    Trophy Points:
    360
    #9
    clear your ie cookies cache and try once
     
    chandan123, Dec 19, 2009 IP