Hello all,
I am new here and new to Apache but wondered if someone might help me with a mod_rewrite issue I have.
The problem I have is that search engines keep requesting certain urls every few seconds which triggers resource heavy sql queries (a custom mod for shopping cart software). These queries keep bringing the server to a halt.
So at the moment I am banning googlebot and microsoft ips so that server stays up which I dont want to do for long.
I need to give a 403 to certain IPs when they request a URL that contains the keyword "xsearch" anywhere in the URL.
I've tried what feels like a million things to make this happen but they don't work.
The closest I have gotten is as follows which is for a chinese bot.
RewriteCond %{REMOTE_ADDR} ^180\.76\.5\..*
RewriteCond %{HTTP_REFERER} ^(http://)?(www\.)?.*(-|.)xsearch(-|.).*$ [NC]
RewriteRule .* - [F,L]
This works if the previous page looked at contained 'xsearch' but when I try and use this to create a {REQUEST_URI} condition instead of a {HTTP_REFERER} it doesn't work.
I only want to stop bots from firing any URLs that contain "xsearch" anywhere in the URL but let them do whatever they want with any other URL that doesnt contain that phrase.
Would very much appreciate any help, I have basically no idea what I'm doing with mod_rewrite - my efforts have been purely based on googling!
Thank you!