How To Include a PHP File Site-wide Using .HTACCESS or other methods -
i want include php file googleanayltics.php
on every page on webserver .php or .html document
i know:
a) how add right before </head>
tag
b) how add right right after <body>
tag
i'd know both methods flexibility
i think .htaccess accomplish easily, , if know how, or if know of easier method please share.
p.s. not want manually go in , enter code on every file, why asking question (for time saving)
edit: see wanted (was hidden due formatting). although possible, clumsy thing do, , not worth effort. see other answer way that.
there 2 php.ini
settings might interested in:
auto_prepend_file
, auto_append_file
they can changed via .htaccess (see other answer).
notes:
these included before or after whole php script; not in specific sections of output.
they affect files handled go through php, means html files not included, unless server set pass html files through php. can done adding following line .htaccess:
addtype application/x-httpd-php .html .htm
auto prepending file generates output dangerous thing do, because affect (break) scripts set headers or use sessions.
Comments
Post a Comment