Monthly Archive for June, 2006

Page 2 of 4

Method of bypassing php_value auto_append//prepend

I bring you the old tutorial on how to put a file before and after each specific page (this would allow you to put “header code” and “footer code” such as trackers, counter, etc.

Subject : Method of bypassing php_value auto_append//prepend
Written By: Tom Rochette
Date: 15 Jul 2005
Level: 2 (Beginner)
Type: SweetTrick (bypassing or workaround)

Since we aren’t allowed to do php_value because the php is complied as a CGI on our servers, I had to find a way to get it working anyway. Here is what I tought about:

in your .htaccess:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^([a-z]+)$ loader.php?p=$1
</IfModule>

and in the loader.php page:

<?PHP
require_once("filebefore");
require_once($_REQUEST["p"]);
require_once("fileafter");
?>

I had to find something like this to use IloveJackDaniels caching method . I hope it help some of you programmers.

This article has been written by Tom Rochette
http://www.ewealthdev.com/

Using .htaccess to simplify your linkings!

.htaccess being one of the main file a SEO work on because of the ability to give proper naming to links, I had written an article about it a year ago. Might be useful for some of the beginners, don’t be shy to ask if you don’t understand something or it doesn’t work as I never took the time to review it (no feedback = no correction).

Subject : Using .htaccess to simplify your linkings!
Written By: Tom Rochette
Date: 14 Jul 2005
Level: 2 (Novice)

Any new webmaster who have took a bit of time to check out all the available resources for them have already heard about .htaccess. This file located in a directory can have many uses, and most of them are often forgotten or not used at his full potential. Discover how .htaccess will make your webmastering job an easy task.

Table of Contents

  1. How can it simplify it?
  2. Use it without any modifications (for redirections)
  3. How to get it working with already written scripts

How can it simplify it?

Often forgotten, the mod_rewrite made a big come back. People started using it to do redirection of virtual addresses (addresses who links to a physical directory or files but don’t exist by itself). The mod_rewrite can be really interesting to see in action since it can change large URLs to smaller one:

Example of a long URL : www.yourdomain.com/ index.php?SearchIndex=Photo&BrowseNodeName=Photo

Example of the same URL, but shorten using mod_rewrite : www.yourdomain.com/Photo/Photo/

As you can see, you’ve saved a lot of space and the URL is easier to remember. With the mod_rewrite, you’ll be able to redirect your member to pages who might have quite long URL, but they will never notice it. It saves you time when you are writing pages since you don’t have to type a long query sentence.

Another good aspect of using the mod_rewrite is you can remove the query string when you are using PHP which makes your pages search engines friendly because most of the time those engine won’t even handle anything beyond the .php?. Now with your new URLs, your pages will look like simple html pages generated on the go.

Use it without any modifications (for redirections)

If you don’t really have any time to change all your URLs in your pages, you can still use mod_rewrite to make simple redirection URL you might use on other websites or give to your friends.

To use mod_rewrite, you’ll need to have it installed on your server.

Then, in a .htaccess file, you’ll write the following content:

<IfModule mod_rewrite.c>

RewriteEngine on

<… Insert your RewriteRules here …>

</IfModule>

Note that the .htacess as been placed in the root folder.

The ifModule will first check if it is possible to use the mod_rewrite. Then, you turn on the RewriteEngine. You can now make your RewriteRule(s) between the IfModule and the /IfModule. Here is an example of one:

RewriteRule ^forum/thread-([0-9]+)$ forum/index.php?showtopic=$1

The ^ and $ are used the same way in PHP, they are string handler. The ^ indicate the beginning of a string and $ the end. Using ([0-9]+}, you’re telling your server to accept any incoming number. This number will be used in our old page and will be called $1. If you use more than one variable, they will be $2,$3,$4,$5,…

The RewriteRule work this way: First you input the part you’d like the server to make virtual (which is ^forum/thread-([0-9]+)$ here). This will make www.yourdomain.com/forum/thread-123 accessible from any browser. The second part indicate where it should go (which page it is suppose to be in fact). Since I’ve used $1, there will be a variable used. The server will load the page www.yourdomain.com/forum/index.php?showtopic=123. The great thing though is that it won’t show this in the address bar. It will show the “cloaked” URL, which is what you want!

How to get it working with already written scripts

If your scripts are already written and you’d like to use them with the mod_rewrite, here is a “workaround” you can use.

First, load the page you’d like to modify the urls to the new one. If it is in PHP format do the following:

  1. Open your PHP : <?PHP
  2. Create a variable you’ll use, I’ll call mine content.
  3. in it, write the following : <<<THECONTENT
  4. Put this above your PHP Content so THECONTENT is the sentence above all your PHP code.
  5. At the end of your PHP code, write THECONTENT;
  6. Then, using preg_replace("stringyourelookingfor","stringyourechangingto","stringinwhichthecontentis");
  7. Echo the page
  8. Close your PHP : ?>

You should end up with something like:

<?PHP
$CONTENT= <<<THECONTENT
all the stuff being echoed
THECONTENT;
$CONTENTx = preg_replace(“?page=”,””,$CONTENT);
echo $CONTENT;
?>

This will make any of your link using index.php?page= to be switched to just their name. Then, in your htaccess, write the following:

<IfModule mod_rewrite.c>

RewriteEngine on

RewriteRule ^([A-Za-z0-9]+)$ index.php?page=$1

</IfModule>

 

What can be useful if you want to add things after the $page variable, is to use the (\w+) in your preg_replace. This will allow you to take any content before or after and use it as a variable to replace text. This would look like

$CONTENTx = preg_replace("’\?page=(\w+)’","\\1/",$CONTENT);

This preg_replace function would now take any content listed after the $page= and replace it. So you’d get www.yourdomain.com/page/ instead of www.yourdomain.com/page. It can be usefull if you want to make your page look like they were indexes of directory.

This article has been written by Tom Rochette

http://www.ewealthdev.com/

Adsense publisher useful tools

Logging your Adsense clicks can have a good impact on your future “web gains”. By tracking which pages, keywords, ads formats, etc. which gives you the best results, you can tweak your pages to optimize them in order to get the best results possible. Furthermore, by tracking which keywords will often give you a click (high CTR), you’ll know on which keywords you should focus your website articles. Don’t work in the dark, open the light!

Free Options

Google Analytics method
First, you’ll want to install the Google Analytics code on your page (at the top of your page) so it tracks your pages statistics. Then you’ll download the script provided on the website and follow the instructions. Once you start getting clicks you’ll be able to see your results in the Google Analytics report page. Note that the statistics are quite restricted but they give you more than what Adsense currently does alone.

AdLogger
Lots of work is currently in progress in this project which is great. It’s currently open-source so you’re free to contribute to the project. There’s a interesting feature that this script offer and it’s the possibility to not show the Adsense banners when a specific visitor (tracked by IP) has clicked on the advertisement more than a specified amount of time. This is a great way to reduce the possibilities of click fraud. You can go check out a demo of the statistics at Demo. There isn’t currently much statistics been shown on the report pages but it’s only a matter of time before it starts getting big as many people are interested in this kind of script.

Paid Options

Adsense Gold
Gives a great deal of details about each and every click you get through your advertisement. I haven’t seen any tracker giving you that much information on Adsense and I’d recommand it to anyone who’s avid to make money online using Adsense. You are able to track keywords, referal domains, IP, ads format, the time, the page, what the ad is about, the link to this ad and even more. All the statistics are related to each other so you’re able to browse back and forth to know how everything went on which is pretty interesting to know. Being able to track pages which gives you the best results, you’ll be able to tweak them and work back on them to enhance them even more giving you bigger chances to high an higher CTR. I should also add that the interface is pretty intuitive for beginners.
Cost: 97$

NicheBOT’s AdSense Tracker
I haven’t had the chance to try this tracker but from what I’ve seen, it looks like their a limited amount of statistics. The tracker doesn’t give information about the keyword that were used in searches nor the entry pages which are in my opinion vital informations.
Cost: 67$

asRep
They offer a demo version in which you have a restricted access to the reports. Check it out at their page asRep Free Trial Version.
The script in itself is not pretty intuitive which makes it hard for someone starting out and it makes you lose a bit of time to learn it. I haven’t really tested it, there’s a demo page at Demo Page but I don’t understand how it works enough to get the statistics I want. I guess the programmer or designer should have thought about making it intuitive since it’s generally not hard to tell “Hey, you select that and then you click here!”. It is said to report the pages, the IPs, the ads format, the clicked ad url, the referrer page and domain and more.
Cost: 50$