Block other website domain DNS from pointing to my website IP address

Home Forums BulletProof Security Free Block other website domain DNS from pointing to my website IP address

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #31795
    Herschel Nichols
    Participant

    I could see that 3 domains point their host to my IP.  For example, if someone type otherdomain.com, it redirect to my IP: 255.255.255.255 which is address of my website. Since my domain is hosted on a dedicated IP, the domain otherdomain.com will load the content of my site.

    There is absolutely nothing I can do about people pointing their DNS to my IP address because it is their DNS. One thing I can do is to completely block/forbidden or redirect these domains visitors to the correct domain by putting some code in my .htaccess file.

    I found some codes mentioned below but I don’t know where to put these custom code in .htaccess

    RewriteCond %{HTTP_HOST} otherdomain\.com$ [NC]
    RewriteRule ^ - [F]

    or,

    RewriteCond %{HTTP_HOST} otherdomain\.com$ [NC]
    RewriteRule ^(.*)$ http://yourdomain.com/$1 [L,R=301]

    or,

    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} ^otherdomain.com$ [NC]
    RewriteRule ^ - [G]

    I have confused what is the right code. Also how to add more clone domains to this list and where can I put these in root custom codes of BPS. Please help me and give some right code to me.

    #31798
    AITpro Admin
    Keymaster

    IP address 255.255.255.255 cannot be your Public website/server IP address.  See below.  In plain English, IP address 255.255.255.255 is an Internal Local Network IP address that is used for broadcasting (sending/receiving/routing) packets internally and not externally (Public facing).

    https://en.wikipedia.org/wiki/Broadcast_address

    A special definition exists for the IP broadcast address 255.255.255.255. It is the broadcast address of the zero network or 0.0.0.0, which in Internet Protocol standards stands for this network, i.e. the local network. Transmission to this address is limited by definition, in that it is never forwarded by the routers connecting the local network to other networks.

    Go to the BPS System Info page and check these things below:
    Server|Website IP Address:
    Host by Address:
    DNS Name Server:
    Public Internet IP Address (ISP):

    Regarding DNS, let’s say a host server is using example IP address:  100.99.88.77 and 1,000 websites are hosted on that server.  In your host server DNS settings you have A Records and CNAME Records that point to your specific/unique domain name.  So what that means is the host server uses your DNS Records to point to ONLY your website domain name based on your DNS Record settings.  See this link for examples:  https://pressable.com/blog/2014/12/23/dns-record-types-explained/

    #31799
    Herschel Nichols
    Participant

    Yes, IP address 255.255.255.255 cannot be my Public website/server IP address. I just give it for example by mistake. I don’t know why this is happening but you can see the page below.

    http://webmasters.stackexchange.com/questions/27970/why-is-another-domain-resolving-to-my-ip-address

    https://www.digitalocean.com/community/questions/other-domain-name-pointing-to-my-droplet-ip-address

    http://www.webdeveloper.com/forum/showthread.php?305633-use-htaccess-to-block-another-domain-from-pointing-to-my-website

    http://www.webhostingtalk.com/showthread.php?t=462642

    Since my domain is hosted on a dedicated IP, the domain otherdomain.com  will load the content of my site.

    #31800
    AITpro Admin
    Keymaster

    Ok the first thing you want to do is setup your Apache vhosts conf file (Virtual Hosts), which should be located in this Apache folder:  /path-to/apache/conf/extra/httpd-vhosts.conf.  You also need to check your DNS settings to make sure you have setup DNS Records correctly.

    Apache VirtualHost Examples:  https://httpd.apache.org/docs/current/vhosts/examples.html

    XAMPP Local Development Server VirtualHost Example:
    Notes: The Apache vhost_alias_module Module directive code must be in your httpd.conf file in order for vhosts to work: LoadModule vhost_alias_module modules/mod_vhost_alias.so and you also need this Include directive code in your httpd.conf file: Include conf/extra/httpd-vhosts.conf After making any changes to server configuration files you must reboot your server in order for the new changes to take effect. Apache httpd.conf file folder:  /path-to/apache/conf/httpd.conf

    ## Example XAMPP vhosts configuration for domain: example.com
    <VirtualHost example.com:80>
    	ServerAdmin postmaster@example.com
    	DocumentRoot "/path-to/example.com"
    	ServerName example.com
    	ServerAlias example.com
    	<Directory "/path-to/example.com">
    		#Options Indexes FollowSymLinks Includes ExecCGI
    		Options All
    		AllowOverride All
    		Require all granted
    		#Order allow,deny
    		#Allow from all
    	</Directory>
    </VirtualHost>

    If setting up vhosts does not work then you can try rewriting Requests using htaccess code based on hostname.
    https://forum.ait-pro.com/forums/topic/htaccess-redirect-www-to-non-www-htaccess-redirect-non-www-to-www/

    # WP REWRITE LOOP START
    # Rewrite non-www to www
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
    RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
    RewriteRule ^index\.php$ - [L]

    And you can combine the other htaccess code that you posted above into the BPS WP Rewrite Loop Start htaccess code like this, but if the problem is originating from the otherdomain site that you do not control then this htaccess code will have no effect because this htaccess code is being used on your website and not the other website:

    # WP REWRITE LOOP START
    # Rewrite non-www to www
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} ^otherdomain.com$ [NC]
    RewriteRule ^ - [G]
    RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
    RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
    RewriteRule ^index\.php$ - [L]
    #32259
    Nitin
    Participant

    You can simply block those domains ip addresses that are pointing towards your domain, put those in deny tab of htaccess file.

    #32289
    Nitin
    Participant

    It really works fast and solved my problem.
    Insert this code in your .htacces

    Rewritecond %{HTTP_HOST} !www.domain.com$
    RewriteRule ^/?(.*) http://www.domain.com/$1 [QSA, R=301,L]

    Put your domain name.

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.