Welcome to WebmasterWorld Guest from 54.91.203.233

Forum Moderators: Ocean10000 & phranque

Message Too Old, No Replies

Hits and 301 Redirects

     
3:42 am on Apr 27, 2006 (gmt 0)

Preferred Member

10+ Year Member

joined:June 13, 2005
posts:479
votes: 0


Which come first to the visiting browser, the .htaccess file or the page? If I have a 301 Redirect in my .htaccess file, is the page hit ever served? The reason for this question is I'd like to use a traffic analyzer which uses some javascript code to track the visitors. However, if the hit sees the 301 Redirect and gets redirected without ever seeing the page (which I suspect is the case) then this method would be useless. Then the question would be how to write a 301 Redirect on the page itself.
12:25 am on Apr 28, 2006 (gmt 0)

Preferred Member

10+ Year Member

joined:Nov 18, 2002
posts:355
votes: 0


The .htaccess gets hit first -- you don't even have to have the physical page on your server to do a 301. So, your Javascript tracker won't be seen.

I don't think you'll be able to get away with putting a redirect on the page either. The problem is, any true 301 redirect is going to get executed before any of the page content gets delivered, even if it's located on the page itself.

So, you're stuck with doing some sort of Javascript redirect after the page has been displayed. This won't be a 301, and is the type of redirect that has been known go get Google to ban you.

I would switch to a host that provides log file access - that way you can see what happens.

12:58 am on May 1, 2006 (gmt 0)

Preferred Member

10+ Year Member

joined:June 13, 2005
posts:479
votes: 0


I have logfile access, but I'm told that these javascript traffic analyzers are better at recording the hits from humans than the logfile analyzers (which are better at tracking the bots). I want to see who is coming to each individual page and where they are coming from, so that I can make a better informed decision about keywords etc for my parked domains (which would have 1 page per domain on my host with a javascript traffic analyzer and a 301 redirect... which until now, having asked in several forums, I don't have a solution for). Your's is the first real answer I've had, and you're saying it's not possible :(

Could I not put the javascript code first in the page followed by a php 301 redirect? Would that not work? (I know, straying a little bit off topic for this forum, but yours has been the best reply I've gotten so far).

11:26 pm on May 3, 2006 (gmt 0)

Preferred Member

10+ Year Member

joined:Nov 18, 2002
posts:355
votes: 0


Sorry for the delay, Stu ... I just got back to this topic.

The problem is that a 301 redirect will only work if there hasn't been any page content delivered to the browser. If you try to do a redirect after having delivered page content (including any Javascript), PHP displays an error message, and doesn't redirect the page.

I guess I'm not sure why you think a hosted web counter solution is better than reading your own logs. In terms of giving you information on where users are coming from and what pages they visit, you should be able to get that from your logs the same way you would from a JS page tracker.

Typically JS page counters are used when your web host can't or won't provide you with raw logs that include referer information. The other thing that they can do is provide some additional information, such as screen size and window size, that you won't find in a logfile. The will show you hits to your 301 redirected pages.

10:39 pm on May 4, 2006 (gmt 0)

Preferred Member

10+ Year Member

joined:June 13, 2005
posts:479
votes: 0


OK. That explains why when I put the redirect after other content, I never got any redirection. I had decided to go with the javascript tracking (I haven't tried any yet) primarily because I'd learnt in the Tracking and Logging conference that the javascript method was better at tracking real people whereas the weblogs were better at tracking bots. It looks like I've got to try the weblog analysis, but from what I recall, I don't get enough granularity (? is that a real word).

OK. we better end this OT thread now. Thanks for all your help.

2:54 am on May 6, 2006 (gmt 0)

Full Member

10+ Year Member

joined:May 3, 2006
posts:263
votes: 0


stu2, if you have access to the raw log files then can't you find a good analyzer that tells you what search terms are being used to reach your pages? My host uses the free analyzer called Webalizer 2.01, and that tells me what search terms have been used by people that requested my pages. (It reads the query strings in the http_referer header.)

If that's not enough for you, and you have access to PHP, why not use PHP to record who visited what? I wouldn't use Javascript for anything server-side. (Actually, I haven't used Javascript since the year 2000 because I loathed it so much.) With PHP you can record details to a database or, as a last resort, email the data to yourself. Then, so long as your script doesn't ouput anything to the user, I believe you can just let PHP initiate a 301 redirect.

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members