Updated: 11 October 2026 · Applies to: Apache 2.4 (.htaccess)

Anyone can point a domain name at your server's IP address. If your site answers for every name, their domain shows your content, which can look like duplicate content to search engines. You can make your site answer only to your own domain.

With .htaccess

Add this at the top of the .htaccess file in your website's folder, with your own domain:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^(www\.)?example\.com$ [NC]
RewriteRule ^ - [F]

Requests for any other host name now get a "403 Forbidden" error. Add other domains that should work (aliases) to the condition, for example ^(www\.)?(example\.com|example\.net)$.

Note: On a shared IP address this is not needed: the web server only sends a domain to your site if it is set up in your account.

Ucartz services for this topic

Was this answer helpful? 0 Users Found This Useful (0 Votes)