With Apache Web server, how to let users only through the set domain name access, and not directly through the server's IP address access it, there are two ways to achieve (only I know, of course, there will be other ways to achieve), are modified httpd.conf files to implement, as illustrated below.
Method One: At the end of the httpd.conf file, add the following code
Namevirtualhost 221.*.*.*
<virtualhost 221.*.*.*>
ServerName 221.*.*.*
<location/>
Order Allow,deny
Deny from all
</Location>
</VirtualHost>
<virtualhost 221.*.*.*>
DocumentRoot "C:/web"
ServerName www.jzread.com
</VirtualHost>
Description: The blue part is to implement any access request that refuses to 221.*.*.* this IP directly, then if you use 221.*.*.* access, you will be prompted to deny access. The red section is to allow access through the www.jzread.com domain name, and the home directory points to C:/web (assuming that your site's root directory is c:/web)
Method Two: At the end of the httpd.conf file, add the following code
Namevirtualhost 221.*.*.*
<virtualhost 221.*.*.*>
DocumentRoot "C:/test"
ServerName 221.*.*.*
</VirtualHost>
<virtualhost 221.*.*.*>
DocumentRoot "C:/web"
ServerName www.jzread.com
</VirtualHost>
Description: The blue part is to pass 221.*.*.* this IP direct access to the request to the C:/test directory, this can be an empty directory, you can also build a home page file, such as INDEX.HMTL, the first file content can be a declaration, the description cannot be directly accessed via IP. The red part means the same as the method.
Note: Restart Apache after modification