The goal is to see if the site works on the live server environment. We recommend setting up a subdomain URL before you officially deploy the site. For example, you can use something like dev.domainname.com. Eventually, you can put it on domainname.com.
However, avoid setting up a subdomain on the host, because this will set up a new directory and make local DNS changes. Instead, set it so that dev.domainname.com is a completely different website. You need to make your live testing site domain a domain alias, which is also called a CNAME record.
For instance, if you created an A record (the record that maps the IP address of the web server to the domain name) as this:
example.com. A 192.0.2.1
You can set up an alias like this:
dev.example.com CNAME example.com.
This lets you set up the website in the same physical location that it will live. It is important to be as accurate as possible so that you can conduct your final tests as if the site was truly online. First set all folder permissions and other settings, then run tests and benchmarks to see how the site performs.