Uncategorized | January 7th, 2021

Parse PHP in html pages without .htaccess

CGI server cant parse php in html pages with .htaccess

In that case we can use SSI (Server Side Includes).

you need to use SSI in your .html and htm files. There is an easy solution for this.
Just add the following line in your .htaccess file:

AddHandler server-parsed .html .htm

This line will tell the server to parse your .htm file as SSI and execute any SSI directives you have there.

The most common usage of SSI is to include the contents of an external file onto a page or across multiple pages on your site. Modify the external file, and all pages that have this file embedded is also updated with the modified information. For a site that uses the same header, navigational menu, or footer across pages, for example, this can save you countless time and energy. The syntax to embed the contents of an external file onto the current page is:

Which one to use depends on where “external.htm” is located. The first command assumes that the file is located in the same directory as the document containing it while the second syntax uses an absolute reference to “external.htm” starting from your root HTML directory. Typically you’ll want to turn to the second syntax, as the external files to include most likely will be in a central directory while the pages including them are scattered across different directories.

There are no comments yet, add one below.

Leave a Comment