View Full Version : SSI and AdSense
spike
08-18-2005, 09:46 PM
Hi,
I understand that SSI (server side includes) is a labor-changing way to change one's AdSense code across all the pages of a whole website or a whole directory, so that specific elements (such as the AdSense ad color scheme) can be changed without having to visit every single page and edit the code manually.
Has anyone used SSI successfully with AdSense, and can they walk me (and the other forum members) through the process of using SSI for AdSense?
Best regards,
spike
dragonsage
08-18-2005, 10:35 PM
I'm using SSI to include my Adsense ads, just as I use them to add the visible page header, navigation bar, and footer sections.
The technique differs whether you are using Apache's SSI, PHP or other scripting, or anything on IIS. I don't use IIS, so you'll have to Google for some examples of SSI with it.
Apache example, in a .shtml file:
<!--#include virtual="/includes/adsense_all_336x280as.html" -->
Real world example: http://www.terrystockdale.com/coffee/espresso.shtml
PHP example, in a .php file:
include ("/includes/adsense_all_336x280as.html") ;
Real world example: http://www.terryscomputertips.com/computers/main_webdesign.php
Same html file, containing the Adsense code straight from Google's Adsense code tool.
Terry,
Including one file within another with IIS is the same as your Apache example
Apache example, in a .shtml file:
<!--#include virtual="/includes/adsense_all_336x280as.html" -->
Real world example: http://www.terrystockdale.com/coffee/espresso.shtml
with the added benefit of not requiring an shtml file as the "container". Any file can be included in any htm/html/asp file and there is no requirement to mess with htaccess (no such animal on IIS).
Hope this helps,
sid
dragonsage
08-18-2005, 11:05 PM
Terry,
Including one file within another with IIS is the same as your Apache example
with the added benefit of not requiring an shtml file as the "container". Any file can be included in any htm/html/asp file
What is the syntax for including other files, when you're working with IIS?
and there is no requirement to mess with htaccess (no such animal on IIS).
Hope this helps,
sid
Cool. I did't realize you could use .htaccess to implement for SSI (it is a pretty neat "swiss army knife" tool). I use the .htaccess files to redirect pages, especially handy for doing a Redirect 301 when a file name is changed or a file is moved (including from one domain to another!).
I also use them to rewrite URL handling rules, which let me transparently handle multiple domains within one hosting account, and to implement password-protected directories.
Terry
Sorry Terry,
I thought by including your original example, I was being clear. My Bad!
The syntax is EXACTLY the same as your Apache example, which is why I referenced it in my response.
sid
spike
08-19-2005, 06:13 AM
Hi Terry and Sid,
Thanks so much for your excellent explanations and examples!
Regards,
spike
ebizindia
08-20-2005, 10:42 PM
To clarify a few points which were left unanswered or not explained enough in my opinion --
1. You do not need to fiddle with .htaccess for SHTML or PHP. For most of the servers, these are handled on the server side by default. You might take the help of .htaccess if you use includes but want to name your files as .htm.
Yes, for those new to the game, it is possible to have .htm extension but still have server side includes.
2. You do not need to have .htm or .html extension for the include file when including a file on the server side (as apparant from a note here). In fact, we generally use .inc as the extension to make it clear that this is to be included.
3. Please remember that you can have a different .htaccess in each folder. This opens up endless possibilities.
scottparat
08-22-2005, 09:56 PM
3. Please remember that you can have a different .htaccess in each folder. This opens up endless possibilities.
this means that if I have a htaccess in my main directory and then place a htaccess file in one of my subdirectory.....that subdirectory will following the rules of the htaccess file in the subdirectory and not the main directory ?
Thanks
Scott
dragonsage
08-22-2005, 10:23 PM
this means that if I have a htaccess in my main directory and then place a htaccess file in one of my subdirectory.....that subdirectory will following the rules of the htaccess file in the subdirectory and not the main directory ?
Thanks
Scott
That really depends on the settings in Apache's httpd.conf file. Apache can be configured to not allow settings to be overridden via the .htaccess files in subdirectories.
In other words, you will have some flexibility (such as putting in Redirect 301 statements for moved files) but may or may not be able to override settings specified by the host.
vBulletin® v3.7.3, Copyright ©2000-2008, Jelsoft Enterprises Ltd.