Apache — Forward AI traffic

Config

In .htaccess (or the equivalent <VirtualHost> block):

RewriteEngine On

RewriteCond %{HTTP_USER_AGENT} (ChatGPT-User|PerplexityBot|Perplexity-User|GPTBot|OAI-SearchBot|anthropic-ai|Claude-Web|ClaudeBot|Claude-User|Google-Extended|Gemini|Applebot-Extended|meta-externalagent|meta-externalfetcher|CCBot|cohere-ai|YouBot|Diffbot|Timpibot|Amazonbot|Bytespider) [NC]
RewriteRule ^ https://oasy.<your-domain>? [R=302,L]

Replace <your-domain>. The trailing ? strips the query string; the
L flag stops further rule processing.

Reload Apache:

sudo apachectl configtest && sudo systemctl reload apache2

Verify

Back on the MCP page, click Check forwarding.

Test yourself

curl -I -A "Bytespider/1.0" https://your-domain.com/
# → HTTP/2 302
# → location: https://oasy.your-domain.com

Notes

  • [NC] makes the UA match case-insensitive.
  • Put this rule above any rewrite rules that rewrite to PHP or canonicalise
    paths — [L] only stops within the same .htaccess scope, not across
    cascading rule chains.
  • If you use mod_security, make sure its rules don't 403 the AI UAs
    before this rule fires.