A few of my website is static and saved as html files, but every page has the same header and footer. For the php files, we can use <? include header.php; ?>. But for those html files, how to make 1 header file and then include it into each static page?
You'll need to use SSI and rename your pages to .shtml there's no way to include .html files. http://www.lissaexplains.com/html6.shtml#SSI
You may use server side includes without renaming the files by setting the XBitHack on. Google is your friend. cheers, gary
Another option would be to enable the parsing of PHP in your HTML files using a directive in your .htaccess file. This way, you could still use the PHP includes. See the article linked below for more details. http://www.desilva.biz/php/phpinhtml.html Mark
Ignore this, the poster is not very well informed of using .htaccess: Read this instead: Just open your .htaccess file and add this line: Addhandler application/x-httpd-php .html Where .html is the general file extension of your site.
Hello Raz2133 and Will Morgan, Both are not working, please go to www.hkhangfong.com/test.php, and use the view source function to check the code. I created a new .htaccess file add the script as you said, but they were not working.
Ah sorry dude. What are your header and footer files called? You could try this: <?php include 'header.php'; /* your page content here */ include 'footer.php'; ?> Code (markup): Let me know how you get on! (And by the way, your server is 404ing for me)