There was a problem loading the comments.

How to Setup Redirects with .htaccess (and Hide From Backlink Checkers)

Support Portal  »  Knowledgebase  »  Viewing Article

  Print
Important: To do a redirect, it's best to deploy on LaunchCDN as a "Static HTML" site, rather than a WordPress site to avoid any WordPress updates from overwriting your redirect.

Here's the code you need to include in your .htaccess file, in order to redirect your domain to another domain, while hiding the redirect from popular backlink checkers.

You can add extra user agents that you want to block on line 2 of these snippets.

Simply copy/paste the snippet that you want, update the target URL on the final line, save it in a text file called .htaccess and upload it to your site's public_html folder

1 - Redirect All Pages to All Pages

With this code snippet, all URLs on domain1.com will redirect to targetdomain.com - eg domain1.com/contact will redirect to targetdomain.com/contact

If you don't want to hide this from backlink checkers, you can remove the second and third lines from this snippet.

RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} (rogerbot|mj12bot|dotbot|gigabot|ahrefsbot|semrushbot|majestic-12|majestic-seo) [NC]
RewriteRule (.*) - [F,L]
RewriteRule ^(.*)$ <a href="https://targetdomain.com/%241">https://targetdomain.com/$1</a> [L,R=301,NC]

2 - Redirect All Pages to a Single Page

With this code snippet, all URLs on domain1.com will redirect to
targetdomain.com/acquired - eg domain1.com/contact and domain1.com's homepage will all redirect to
targetdomain.com/acquired

If you don't want to hide this from backlink checkers, you can remove the second and third lines from this snippet.

RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} (rogerbot|mj12bot|dotbot|gigabot|ahrefsbot|semrushbot|majestic-12|majestic-seo) [NC]
RewriteRule (.*) - [F,L]
RewriteRule ^(.*)$ <a href="https://targetdomain.com/acquired">https://targetdomain.com/acquired</a> [L,R=301,NC]

Share via
Did you find this article useful?  

Related Articles


Comments

Add Comment

Replying to  

Captcha
© LaunchCDN