Forum Moderators: coopster
I have tried editing the .htaccess with no success. My pages are .php so I can protect 1,000's of pages with a php script.
Would it be easier to to rename the files with an .html extension, tell the server to parse html for php, and then tell the server to process the includes in the html pages?
Is it possible to use an include on a PHP page?
check out include_once , include , require , require_once functions on php.net
My pages are .php so I can protect 1,000's of pages with a php script.
I am not sure what exactly script is for?
Would it be easier to to rename the files with an .html extension, tell the server to parse html for php
You can do it easily to show .php files as .html just use mod_rewrite in apache
I hope this will give you some insight and will keep you busy.
And PS You are welcome to WebmasterWorld
To include files using SSI, you have to have the server parse files with a certain extension to look for your includes. Normally this is the .shtml extension.
test.shtml
You can add other file extensions to your config, for example, have all .html files parsed for SSI directives; in this case, you'd add .php.
This is where the possible danger comes in, you're asking the server to parse all php files for SSI **and** asking the server to execute the file as a php script. It may not create a problem, but it may create some server-killing recursive loop. At the very least, the possibility exists that in parsing for SSI directives, the code in your PHP may convince the SSI parser there is an error in the file.
You're probably better off using php includes and modifying the included file so it behaves the way you want.
This parses php in my html page:
AddType application/x-httpd-php5 .htm .html
AddHandler x-httpd-php5 .htm .html
When I add this below to parse for includes, include works but no parsing of the php.
Options +Includes
AddType text/html .shtml .txt .html .htm .php
AddHandler server-parsed .shtml .txt .html .htm .php