in reply to Need to remove session IDs
if ($ENV{'HTTP_USER_AGENT'}=~/^googlebot\/2\.1|slurp|some_other_bot_na +me$/){ #put any other routines you want to run on the request -> like logs, e +tc here or just... print "Location: "http:\/\/www\.example\.org\/$ENV{'PATH_INFO'}"; } # And if not in your bot-list, do what you originally planned... else{ your original script's body here }
it probably be easier to use the whole googlebot\2.1 stuff in a $variable associated with some array - than putting too many | or statements into that regex... but i'm being lazy and non-thinking at the moment.
one word of caution before using something like this-> any and all $ENV variables need to be cleaned up; One needs to ensure that they have no evil characters in them. As a thought for the directories you have there: $ENV{'PATH_INFO'}=~/^([a-zA-Z_0-9]+\/?)*$/
one can't rely on the $ENVironmental variables too much, but in this case, it probably would work.
|
|---|