Forced Ads On ISPConfig With Debian Etch
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)
|






Recent comments
7 hours 23 sec ago
7 hours 11 min ago
7 hours 54 min ago
8 hours 58 min ago
13 hours 3 min ago
15 hours 19 min ago
16 hours 35 min ago
16 hours 35 min ago
16 hours 50 min ago
22 hours 41 min ago