PDA

View Full Version : .htaccess include footer


grandpagenocide
9th March 2008, 03:50
I am not sure if this is the right forum to put this in, but I am trying to use htaccess to put a footer on all sites created on one of my ispconfig servers, howerver, each way I write the htaccess file gives me a 500 error, an error refering to pear, or has no effect on the index.html or index.php Any ideas on that that may work without any major changes to the server? php_value output_buffering 4098

AddType application/x-httpd-php htm
AddType application/x-httpd-php html
php_value auto_append_file footerad.txt
powered by ISPConfig

Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0

Fatal error: Unknown: Failed opening required 'footerad.txt' (include_path='.:/usr/share/php:/usr/share/pear') in Unknown on line 0

grandpagenocide
9th March 2008, 04:03
i also tried in my htaccess php_value output_buffering 4098
php_value auto_prepend_file 'http://yourlinkhere.com/headerad.php'
AddType application/x-httpd-php htm
AddType application/x-httpd-php html
php_value auto_append_file 'http://yourlinkhere.com/footerad.php'

Warning: Unknown: URL file-access is disabled in the server configuration in Unknown on line 0

Warning: Unknown: failed to open stream: no suitable wrapper could be found in Unknown on line 0

Fatal error: Unknown: Failed opening required 'http://test.andpower.info/headerad.php' (include_path='.:/usr/share/php:/usr/share/pear') in Unknown on line 0

Leszek
9th March 2008, 12:37
It's a shame that
php_value auto_prepend_file
and
php_value auto_append_file
work only with php scripts (You can append text files to).

grandpagenocide
9th March 2008, 16:32
lesxek, as you see in the second example I used a php header and footer as well. (they need a smiley with a gun to its head for frustration). Is there a way to include a footer in all formats, php, html. htm, etc. If I get this working, I want to set up a module, that turns on and off forced ads for clients.

Leszek
9th March 2008, 18:26
I'm looking for the same thing.

grandpagenocide
9th March 2008, 18:41
If i can figure out how to do this with htaccess I can write the module without a problem. Its just frustrating the hell out of me trying to get htaccess working.

edge
9th March 2008, 21:32
Anything of value about this error in your Apache error log file?

grandpagenocide
9th March 2008, 21:37
nope nothing that matters, I am assuming its with the AllowOverride directive, but i added allowoverride all to the apache directives
[Sun Mar 09 15:35:42 2008] [alert] [client 24.190.176.116] /var/www/web43/web/.htaccess: php_value not allowed here

grandpagenocide
9th March 2008, 22:53
Ok, I have the htaccess working in the /*/web folders by adding the AllowOverride Options tag, but now I need either to enable htaccess in the /var/www folder or to find a way for it to create an htaccess file with each new web. Any ideas?
Figured it out:

I created a folder called ads in var/www/ads

placed my footer.php there
and placed a blank.php there

created an htaccess file in /var/www containing

php_value output_buffering 4098
AddType application/x-httpd-php htm
AddType application/x-httpd-php html
php_value auto_append_file '/var/www/ads/footer.php'

I enabled php server wide, as I give all my clients php anyway,

in apache2.conf under the <Directory /var/www/sharedip>...</Directory>

<Directory /var/www>
Options +Includes -Indexes
AllowOverride None
AllowOverride Indexes AuthConfig Limit FileInfo Options
Order allow,deny
Allow from all
<Files ~ "^\.ht">
Deny from all
</Files>
</Directory>

Also add options in the allowoverride in /var/www/*/web and Allow from root in
<Files ~ "^\.ht">
Allow from root
Deny from all
</Files>

to disable the ads on a particular site

create an htaccess file and place it in the web folder of the client
php_value output_buffering 4098
AddType application/x-httpd-php htm
AddType application/x-httpd-php html
php_value auto_append_file '/var/www/ads/blank.php'

grandpagenocide
9th March 2008, 23:32
ill ask a mod to move this to tips and tricks

edge
10th March 2008, 09:57
As requested, I've moved this thread to Tips/Tricks/Mods