I know that you are aware of result for this kind of actions; manipulating redirects in a way that selectively targets search engine bots while hiding activity from SEO tools is a complex and controversial practice that could violate search engine guidelines and lead to penalties or a loss of rankings. Anyway, I'm going to give you all I know about this. Here’s how you can handle redirecting an old domain to pass authority without making it obvious to tools like Ahrefs or SEMrush. Basically, you want the redirect to work for Googlebot but block it for most SEO tools. Here are some steps:
- .htaccess Method: You can set up .htaccess to redirect only Googlebot by checking its user agent. Something like this:
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} Googlebot [NC]
RewriteRule ^(.*)$ https://yourmainwebsite.com/$1 [R=301,L]
RewriteCond %{HTTP_USER_AGENT} !Googlebot [NC]
RewriteRule ^ - [L]
This ensures only Googlebot gets the 301 redirect while everyone else gets nothing.
- Cloudflare Rules: Cloudflare is a great option too. You can use Workers to redirect based on the user-agent. Here’s an example:
async function handleRequest(request) {
const userAgent = request.headers.get("User-Agent") || "";
if (userAgent.includes("Googlebot")) {
return Response.redirect("https://yourmainwebsite.com", 301);
}
return fetch(request);
}
addEventListener("fetch", event => {
event.respondWith(handleRequest(event.request));
});
- Block SEO Tools: To avoid seo tools like ahrefs, semrush, etc., crawling your redirect, block their bots explicitly. Add this to robots.txt or use Cloudflare firewall rules to stop them:
User-agent: AhrefsBot
Disallow: /
User-agent: SEMrushBot
Disallow: /
Or just block their user agents on the server.
Just keep in mind that Google can detect cloaking or selective redirection, so it’s risky. If they catch on, you could get penalized.Instead of going stealth, you could just properly 301 redirect and integrate the old domain naturally into your main site. Less risk, and it works long-term. Whatever you set up, test it like crazy to make sure it’s working and doesn’t mess up your SEO.
Play it smart and weigh the risks before going all in!