What is the best way to split a large html file into three small html files?

I have a very large site and I was wondering how to separate one HTML file from three separate HTML files. To organize the code as separate components of the whole, for example:

Header.html

Body.html

Footer.html

How can I split the html code into three separate html files, but still make them work together as a whole?

+1
source share
2 answers

A simple method would be to use PHP for concatenation 3:

Step 1) . In your .htaccess file, enable the server to parse the files .htmland .htmas .phpfiles:

AddType application/x-httpd-php .html .htm
AddHandler application/x-httpd-php .html .htm

Step 2) In page.htmlwrite (only) the following:

<?php

include '/home/example/public_html/header.html';
include '/home/example/public_html/body.html';
include '/home/example/public_html/footer.html';

?>

N.B. /home/example/public_html/ . .

, page.html, .html .php PHP .html.

+1

Source: https://habr.com/ru/post/1619611/


All Articles