Attach Files through .htaccess

In this tutorial we’ll create a Code Snippet that will Attach Files to a page at top of file or Bottom of the file.
Attach Files through .htaccess

In most of the site that uses hand written codes, the common and routine procedure followed by the programmers is to break up the site code to external files and add them, mainly the header and footer section of the website which is common to all the pages in that site, and also some other parts which is used in most of the pages. Though this code cannot be used for files that are not used in all pages.

This can act as a alternative to PHP include or PHP require but only to the files that is used in all the pages as there is no conduction check to add that to selected page rather that make a separate directory.

This method can be used for the footer and the header section of the site in order to prevent writing the include code on all the can have them automatically attached to all the files wither at top or bottom automatically through your .htaccess file.

php_value auto_prepend_file "/real/path/to/file/functions.php"
php_value auto_append_file "/real/path/to/file/footer.php"