Google's 302 Redirect Problem

Post your Click counter digestion problems here
Post Reply
phpNewbie

Google's 302 Redirect Problem

Post by phpNewbie »

URL: script not installed yet
Version of script: Version: 1.1
Version of PHP: PHP_4.3.11
Host: Apache_1.3.33
Have you searched for your problem: YES
If so, what terms did you try: keyword= "301"

I spent hours researching click counter scripts. I liked yours best. Before I install it there are a couple of small changes I'd like to make.

(1) For the past two years there have been countless complaints on SEO forums about Google incorrectly attributing content from destination pages to sites using HHTTP/1.1 302 redirects. It has happened to me too. I've seen my homepage listed in Google with the URL of someone else's link page. I don't want to do that to other webmasters. Apparently, the problem doesn't occur if a 301 "Permanent" redirect is used (see http://www.elouai.com/redirect.php). I would like to add an extra line at the end of click.php:

Code: Select all

// Redirect to the link URL
header("HTTP/1.1 301 Moved Permanently");
Header("Location: $url");
exit();
(2) In the article it says: "You can accidently hide your pages from getting properly indexed by Google if in the URL string you have the 'id' parameter. Google would then assume that is a session id and would not follow the link." I don't know whether that's true, but I'd like to play safe and rename the token like this:

Code: Select all

Before: http://www.example.com/ccount/click.php?id=13

After : http://www.example.com/ccount/click.php?site=13
I'm a PHP newbie, but I think it would only require a small change at the beginning of click.php:

Code: Select all

// First check if the ID is set and ...

$id=$_GET['site'];
if(empty($id)
And just in case a webmaster visits the page that linked to her site I'd like to rename 'click.php' [in settings.php]. The filename will then show what kind of redirect is being used:

http://www.example.com/ccount/redirect-301.php?site=13

Please let me know if you see any potential problems that I overlooked. Thanks.

phpNewbie
Klemen
Site Admin
Posts: 10116
Joined: Fri Feb 11, 2005 4:04 pm

Post by Klemen »

Hi,

Sounds good, I don't see any problems. Try it ad let us know how it goes and I will think about making these changes to the original script.

Thanks for the kudos, if you like CCount please consider rating / reviewing it (you will find link in the readme.htm file).

Regards
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
phpNewbie

Post by phpNewbie »

I set up a test page to try out the click counter at:

http://www.freepgs.com/devon/ccount-test.htm

The script is working fine, so I'll add it to the rest of the pages soon. When that's done, I'll put a link to PHPJunkYard.com at the bottom of the homepage and give it top score at Hot Scripts.

There were some more changes I had to make within "index.php" because I renamed the token from "id=" to "site=". I changed the echoed URL text strings in the output for the Usage example (two lines), and also within function add($url):

Code: Select all

function add($url) {
...
...

<?php echo("$settings[click_url]?id=$previd"); ?>
// changed to
<?php echo("$settings[click_url]?site=$previd"); ?>
...
I have one last question. The two text files which are given CHMOD permissions of 666 can be read by anybody. I changed the names of the files as a safety precaution, but is there a more secure method to prevent snoops from looking at the contents?

phpNewbie
Klemen
Site Admin
Posts: 10116
Joined: Fri Feb 11, 2005 4:04 pm

Post by Klemen »

Nope, the files MUST be set to 666, no other way of having them writable by the script.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Post Reply