Today, my customer has come to me to view his WordPress website using an IP address. You can use an IP address as your hostname. However, we do not recommend this method.
There are a few reasons and you have these criteria. Actually, I still cannot find a good reason for doing this.
- You have a dedicated IP address and resolved to only one site. You can use it as a default site.
- Private site. Do not want others to resolve using a domain name.
- Do not want to use reverse and forward DNS. Maybe for point of failure.
- Never hard code a link using domain name every permalink is managed by the WordPress.
If anyone can think of a valid reason, please write down the comment below.
Getting a WordPress website using an IP address must at least meet the first criteria like what I have mentioned earlier. In addition, you need to change the name to IP address in ‘General Settings’ of your WordPress website or define it in your wp-config,
In this case, you can use an IP address.
However, if you are making a new website or staging, I personally recommend the ‘host file’ method to resolve locally. The domain name can use the same if the website has a different IP address. If it is done using the same IP address, you cannot use the same domain name but a fake domain name.
If you are using a fake domain name you will have to update the general settings or define it in the wp-config file.
In this way, your WordPress website is always accessible and it will not run into errors like ‘404’ page not found.