HostAdvice Special Deals! Save 75% on all Shared Hosting Plans & Locations

Back to Business Deals! Save 70% on all Shared Hosting Plans & Locations - Starting from $2.95/mo

How to Access WordPress Installation with a Temporary URL

Updated on Aug 16, 2019

Frequently, for various reasons, we may need to use temporary URLs. For example, in case you are migrating an existing WordPress website from another host to FastComet, you probably want to move the site and test it before pointing the domain name (via the DNS) to your new account that’s hosted on our servers. Another reason could be because you don't yet have an active domain. WordPress is dynamically driven to use your domain name, which means that the CMS will not work correctly using a temporary URL when its installation was configured to use your domain name.

This post includes:

What is WordPress Temporary URL?

A temporary URL (Uniform Resource Locator) is the substitute for a domain name. The temporary URL is perfect when you need to test your WordPress site without a domain or when you are transferring your website to FastComet while your domain name still points to your previous provider, or when it’s propagating.

Why use a Temporary URL with WordPress?

There are two main reasons where a temporary URL may be of use to you, which are:

  • Viewing a site that you’ve migrated before you switch the DNS to FastComet;
  • Showing your client their WordPress site before making it live on the actual domain name.

How to Create a Temporary URL for WordPress Development?

There are two options when it comes to configuring your WordPress installation with a temporary URL and accessing it without pointing your domain to the actual server.

Option 1 (Beginners): Edit the wp_config.php File

You can change the URL  depending on how your WordPress website works by editing the wp.config file:

  • Go to cPanelFile Manager;
  • Proceed to find the folder where your WordPress site’s files are located (if it’s the main website for your account you should look in the public_html).
  • Locate the wp-config.php.
  • There you have to add the following rules in the wp_config.php file:
    define( 'WP_HOME', 'http://test.workhard.example.com');
    define( 'WP_SITEURL', 'http://test.workhard.example.com');
    Where http://test.workhard.example.com should be your FastComet temp URL generated form client area
  • Once ready to point the actual domain you have to remove those two lines of code from the wp_config file and your website will be accessible via your actual domain.

Option 2 (Advanced): Modify Your Host Files

You can direct all traffic from your local computer to access your website on a specific server without the need for pointing your domain. To perform this, you should perform a hosts file modification on your local computer. The hosts file modification is to “Fake” your local computer to think that the domain is right there on your server, while in fact, the connection is only to the IP address.

Depending on the OS (operational system), you need to follow the steps below:

Windows Users

If you are using Windows OS you should access the hostsfile from:

C:\Windows\System32\Drivers\etc\

You can open the hosts file with your favorite text editor. In the file you should write:

xxx.xxx.xxx.xxx domain.com

where xxx.xxx.xxx.xxx is the IP address of the server, where your website is hosted, and domain.com is the actual domain name set on your website.

Mac OS Users

If you are using Mac OS X, you should access ApplicationsUtilitiesTerminal. Once you accessed the terminal, write the following command:

sudo nano /private/etc/hosts

Type your user password when prompted. Once the hosts file is accessible for changes, you should enter the following line:

xxx.xxx.xxx.xxx domain.com

where "xxx.xxx.xxx.xxx" is the IP address of the server that is hosting your website, and domain.com is the actual domain name set on your website.

Linux Users

If you are a Linux user, keep in mind that you will have to open a terminal window. Use the terminal to access the hosts file with the following command:

sudo nano /etc/hosts

On a new line in the file enter:

xxx.xxx.xxx.xxx domain.com

where xxx.xxx.xxx.xxx is the IP address of the server, where your WordPress site is hosted, and domain.com is the actual domain name set on your website.

When you complete the changes on your hosts file, you can save it and access your website the usual way. It will lead to the specific server that you defined in the hosts file, and you will be able to test from your local machine without pointing your actual domain.

You have an additional option to access your website without having to create a host file on your local computer. There is a web tool that will do that for you where you have to simply enter your server IP and the site domain name https://hosts.cx/.

The SEO Perspective

Google has its strict policies on duplicate content/URLs and to avoid this SEO issue; we recommend robot-restricting robots.txt on the temporary URL, meaning the search engines won't index the http://test.workhard.example.com URL.

If you would like to block all crawlers/bots from your WordPress site, you will have to add the following lines inside the robots.txt file:

User-agent: *
Disallow: /

The first line means that the rule will apply to all robots, and the second line means that it will disallow the access to all of the pages on your website. Whenever robots visit your site, they will initially check the rules that you have set in the robots.txt file and will proceed only if you are actually allowing them to access your website's pages. By default, the robots.txt file is located inside the web root directory of your domain name, but if you are not able to find it, you can create it by yourself.

Contact us for Assistance

Know that you can always open a support ticket when you are in need of some help. Our expert technical support representatives work 24/7 and will always help you with resolving your issues as soon as possible. 

We hope you find this article useful. Discover more about FastCloud - the top-rated Hosting Solutions for personal and small business websites in four consecutive years by the HostAdvice Community!

WordPress Hosting

  • Free WordPress Installation
  • 24/7 WordPress Support
  • Free Domain Transfer
  • Hack-free Protection
  • Fast SSD Storage
  • Free WordPress Transfer
  • Free CloudFlare CDN
  • Immediate Activation
View More