Forum Moderators: phranque

Message Too Old, No Replies

All Search Engines Puke When Fed

<a href="<!--#echo var="HTTP_REFERER" -->">Back</a>

         

jim_w

9:55 pm on Apr 24, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I hope this the right place to post this.

OK, I give up, why does every se puke on this line? I don’t want do use js unless I have to. The line works fine with every browser on my unix server, but every se gives me a

[Tue Apr 1 09:22:52 2003] [error] [client 64.68.82.57] File does not exist: /home/xxxxxx/public_html/(none)

Every bloody se does it. But if I redirect it, the all can eat it fine.

crawler11.googlebot.com - - [01/Apr/2003:09:22:52 -0600] "GET /(none) HTTP/1.0" 404 3725 "-" "Googlebot/2.1 (+http://www.googlebot.com/bot.html)"

Redirect /(none) [mydomain.com...]

crawler11.googlebot.com - - [24/Apr/2003:10:22:26 -0500] "GET /(none) HTTP/1.0" 302 293 "-" "Googlebot/2.1 (+http://www.googlebot.com/bot.html)"
crawler11.googlebot.com - - [24/Apr/2003:10:22:29 -0500] "GET /index.html HTTP/1.0" 200 35038 "-" "Googlebot/2.1 (+http://www.googlebot.com/bot.html)"

Since the browser see the url they came from, they don’t redirect.

BTW, it does help catch bots.

j105.crc23.jaring.my - - [22/Apr/2003:04:54:22 -0500] "GET /(none) HTTP/1.1" 302 305 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705)"

I don’t want to do a ‘Bozo No-No’, but I do want to use HTTP_REFERER instead of js and since I have several pages that dead end from every page with a menu, the HTTP_REFERER is a real good way of sending users back to the page they came from.

Any ideas?

gsx

10:03 pm on Apr 24, 2003 (gmt 0)

10+ Year Member



HTTP_REFERER can be blocked. And Search Engines do not give you a referer when spidering the site. The logs you have given show the referer to be "-". Therefore your statement becomes <a href="">Back</a> to any spider.

The best way to insert a back button is with JavaScript: <a href='#' onclick='javascript:back()'>Back</a> or someting along that line...I can't quite remember.

Try this though... print the back link using javacript: <script>document.writeln("<a href='#' onclick='back()'>Back</a>");</script>. This means users with JavaScript enabled will see the back button, those without will not, and those without will not click on a link that does nothing!

Welcome to the forums.

jim_w

10:25 pm on Apr 24, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yea, I know all of that. I had js before I went with the HTTP_REFERER.

I guess my question is, is there any way to redirect with out getting my hands slapped by evey SE? I mean, it is a legal way of doing things.

I don't understand why when a SE sees (none) it doesn't just ignore it. I have never seen a page called (none), but I guess one could exist. Heck, I wasn't even sure at first if i could redirect (none). Something came back (null) once as well, but it was a email harvester, so I didn't do anything about that.

BjarneDM

7:22 pm on Apr 30, 2003 (gmt 0)

10+ Year Member



do a test and see i if HTTP_REFERRER is set:

<?php if(isset(HTTP_REFERRER)) echo(HTTP_REFERRER) else echo(someting);?>

in my opinion, it's always a good practise to check and initialise any and all variables that you use - even ones set by the system, the server and php - for valid values.

jim_w

3:21 am on May 2, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I tried it.

I never have written any php stuff but I have been writing ‘C’ for 15 years, I can see how that might work. But it didn't work verbatim and I don’t really want to go through another learning curve to do something that is valid HTML 1.0 stuff. I reckon it’s missing at least the a href= part. All it did as written was print the line, and when I played with it a little, I got either nothing, or ) else echo(someting);?>

I could write a PERL script and do a #exec cgi=, but that is a long way to go to correct something I shouldn’t have to. I noticed in google, it followed (none) to my index.html and re-indexed index.html file. Geeze!

BjarneDM

6:21 pm on May 2, 2003 (gmt 0)

10+ Year Member



if you want to use the php value then the correct form is:
<a href="<?php if(isset($_SERVER[HTTP_REFERRER])) echo($_SERVER[HTTP_REFERRER]) else echo(someting);?>">link</a>

the documentation is here: [php.net...]

if you only :-) have been messing around with C and Perl, then PHP is something of a new ballgame, as you can almost freely mix html and PHP into each other

jim_w

8:50 pm on May 2, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



1000 thanks BjarneDM

nafmo

4:51 pm on May 3, 2003 (gmt 0)

10+ Year Member


Apache actually inserts "(none)" if there's no variable by that name. It would do that for me to, since I have disabled referrer logging in my browser.

You can check for the existance of the variable in SSI by using the if directive. Something like this:

<!--#if expr="$HTTP_REFERER = /.+/"--><a href="<!--#echo var="HTTP_REFERER" -->">Back</a><!--#endif-->

I haven't tested if it actually works for HTTP_REFERER, though, I used to use this to check DOCUMENT_ROOT for a document available at two URLs.