Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To redirect a domain for all of its URLs, you can use a 301 redirect. This will ensure that all traffic to the old domain is redirected to the new domain. Here's how to do it:

  1. Log in to your domain registrar and navigate to the DNS settings for your domain.
  2. Create a new CNAME record for your domain that points to the new domain.
  3. Update the A record for your domain to point to the IP address of the server that hosts your website.
  4. Add a .htaccess file to your server and add the following code:

on RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?approvedsite\.com [NC] RewriteRule \.(gif|jpe?g|png)$ - [NC,F,L]

This code will allow hotlinking only for the approved website, and all other requests will be denied with a 403 Forbidden error.

  1. Test the redirection and hotlinking. Type in the old domain name to see if it redirects to the new domain, and try to hotlink an image from an unapproved site to make sure it's blocked.

With these steps, you can redirect your domain for all of its URLs while also allowing hotlinking exclusively for approved websites.