Forced Ads On ISPConfig With Debian Etch
|
Submitted by webcave (Contact Author) (Forums) on Wed, 2008-08-20 19:36. :: Debian | ISPConfig | Control Panels
Forced Ads On ISPConfig With Debian EtchThis howto forces ads on every single site that you have and cannot be deleted by users from the .htaccess - it does not even use .htaccess. I am using Debian Etch and ISPConfig 2.2.24. Steps that will be done: - Edit apache config. PHP must be enabled server wide for this to work, not to much of a biggie - you should offer PHP by default anyway, it's so common nowadays.
Step 1Enable PHP system wide: vi /etc/mime.types Uncomment these 4 lines of code: [...] #application/x-httpd-php phtml pht php #application/x-httpd-php-source phps #application/x-httpd-php3 php3 #application/x-httpd-php3-preprocessed php3p #application/x-httpd-php4 php4 [...] vi /etc/apache2/mods-enabled/php5.conf Uncomment these 2 lines of code: <IfModule mod_php5.c>
Step 2Editing Apache files: vi /etc/apache2/apache2.conf Towards the bottom of the apache2.conf you will find: <Directory /var/www/sharedip> Options +Includes -Indexes AllowOverride None AllowOverride Indexes AuthConfig Limit FileInfo Order allow,deny Allow from all <Files ~ "^\.ht"> Deny from all </Files> </Directory> Right after this add: <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> Under that you will find: <Directory /var/www/*/web> Options +Includes -Indexes AllowOverride None AllowOverride Indexes AuthConfig Limit FileInfo Order allow,deny Allow from all <Files ~ "^\.ht"> Deny from all </Files> </Directory> Change that to: <Directory /var/www/*/web> Options +Includes -Indexes AllowOverride None AllowOverride Indexes AuthConfig Limit FileInfo Options Order allow,deny Allow from all <Files ~ "^\.ht"> Allow from root Deny from all </Files> </Directory> Save and close. Now let's restart Apache: /etc/init.d/apache2 restart
Step 3Creating a directory for ads: mkdir /var/www/ads
Step 4We are going to create one file. We will make header.php: vi /var/www/ads/header.php Now we must enter the info for the header ad file: <? $adfrees = '/var/www/web1/web'; //Change this to the web you want without ads $dir = getcwd(); if ($dir == $adfrees) { echo ''; } else { echo ' AD CODE HERE '; } ?> The first highlight is the directory name of the file you want without ads. The second highlight is where you would put your ad code from Google and such.
Step 5We must now edit the master vhost file so it will automatically put ads in every single site forcefully. vi /root/ispconfig/isp/conf/vhost.conf.master Towards the bottom you will see: <IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
RewriteRule .* - [F]
</IfModule>
Right below it add: php_value output_buffering 4098
php_value auto_prepend_file '/var/www/ads/header.php'
AddType application/x-httpd-php htm
AddType application/x-httpd-php html
That code is if you want your ad on the top of the page if you want it on the bottom instead use this code: php_value output_buffering 4098
php_value auto_append_file '/var/www/ads/footer.php'
AddType application/x-httpd-php htm
AddType application/x-httpd-php html
The highlighted part is where you would put your file name if you changed it. Save and close this file then restart ISPConfig: /etc/init.d/ispconfig_server restart
DoneThat's it - you now have real forced ads that cannot come off of the page at all! Written by: Joey C. (web-cave.net)
|
www.seamlessenterprise.com
One number. One voicemail. Seize the lead. Sprint Mobile Integration.
www.seamlessenterprise.com
One Number. One Voicemail.
Make it easier for clients to reach you. Turn your desk phone and mobile phone into one with Sprint Mobile Integration.
www.seamlessenterprise.com
One number. One voicemail. Sprint Mobile Integration.
www.seamlessenterprise.com
One number. one voicemail. Seize the lead with Sprint. Learn more
AT&T Synaptic Compute as a Service. Boost your power on demand.
Trial: IBM Cognos Express Reporting, Analysis & Planning
Learn benefits of Simpana software.
View the Gartner Video
Sprint 4G - The Ultimate Mobile Broadband
Click here
SAP-Business Objects Crystal Reports Server
Complete reporting without hidden costs. Free Trial







Recent comments
15 hours 16 min ago
16 hours 23 min ago
16 hours 57 min ago
20 hours 51 min ago
21 hours 51 min ago
23 hours 47 min ago
1 day 1 hour ago
1 day 3 hours ago
1 day 9 hours ago
1 day 17 hours ago