Forum Moderators: phranque

Message Too Old, No Replies

badbot help

         

spy007

2:08 am on Dec 4, 2003 (gmt 0)

10+ Year Member



I am using the bad bot script from [webmasterworld.com...] I have it working ok. Right now I am redirecting a non-existent file, that is excluded in my robots.txt, to my bad bot script via a redirect in my cgi-bin .htaccess file. That works ok. I would like to redirect via a rewrite rule if possible, but I can't seem to get it to work. I have the following in my cgi-bin .htaccess file:

options FollowSymLinks execcgi
RewriteRule formmail\.cgi$ /badbot.cgi [L]

When I access [mysite.com...] all I get is a 403 forbidden error. My log file shows:
"script not found or unable to stat: /home/virtual/site__/fst/var/www/cgi-bin/formmail.cgi"

I know formail.cgi will not show as it is a non-existent file. What am I doing wrong?

jdMorgan

9:07 pm on Dec 4, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



spy007,

I see several potential problems:

  • In the Options directive, you have disabled all other options by omitting the "+" signs.

  • In the Rewriteule, "/badbot.cgi" refers to the script in your web root directory. If the script is in the cgi directory, either prepend the directory name, or omit the leading slash.

    When you get the error, what does your error log have to say about it?

    Jim

  • spy007

    10:12 pm on Dec 4, 2003 (gmt 0)

    10+ Year Member



    OK jdMorgan,
    I put the following in my cgi-bin .htaccess:
    options +FollowSymLinks +execcgi
    RewriteRule formmail\.cgi$ trap.cgi [L]

    I get a 404 error and the following in my log file:
    script not found or unable to stat: /home/virtual/site__/fst/var/www/cgi-bin/formmail.cgi

    I'm sorry, but I don't understand what prepend the directory name means.

    jdMorgan

    10:48 pm on Dec 4, 2003 (gmt 0)

    WebmasterWorld Senior Member 10+ Year Member



    The 404 indicates that your rewrite is not taking place, since the path was not changed.
    If you haven't done it, you'll need to enable the rewriting engine:

    [b]O[/b]ptions +FollowSymLinks +[b]E[/b]xec[b]CGI[/b]
    RewriteEngine on
    RewriteRule formmail\.cgi$ trap.cgi [L]
    - or prepend the directory name, like this -
    RewriteRule formmail\.cgi$ [b]/cgi-bin/[/b]trap.cgi [L]

    Jim

    spy007

    11:11 pm on Dec 4, 2003 (gmt 0)

    10+ Year Member



    Allright! I got it working.

    RewriteEngine on
    RewriteRule formmail\.cgi$ trap.cgi [L] just gave me a 404 error but no redirect.

    RewriteEngine on
    RewriteRule formmail\.cgi$ /cgi-bin/trap.cgi [L] worked like a charm.

    Thanks jdMorgan!