.htaccess » How to access WordPress using temporary server URL

How to access WordPress using temporary server URL

We occasionally find ourselves in a situation where we need to test the website first, then point the domain name if everything is in order.

To achieve this there are multiple ways:

  • Edit Hosts file on your local computer
  • Use online service such as skipDNS
  • Access WordPress using temporary server URL

In this guide We will be using the third method and show how to access WordPress using temporary server server URL.

The link will be in the format: http://serverhostname.com/~cpanel_username/

To achieve this We will edit two files:

From cPanel > File Manager edit the wp-config.php file and add the following lines to it:


Save the file and edit the .htaccess file:

# BEGIN WordPress

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /~cpanel_username/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /~cpanel_username/index.php [L]

# END WordPress

That’s it, your website is now accessible via: http://serverhostname.com/~cpanel_username/

You can test it before changing DNS, and if everything is OK don’t forget to remove changes made to those two files.

See also  How to bypass cache and always view uncached content in WordPress

Was this post helpful?

Leave a Comment

I enjoy constructive responses and professional comments to my posts, and invite anyone to comment or link to my site.