Preview website before making DNS changes on cPanel

269ac00f765508cb74b25d006dbf5bb2

Written by Dennis Nind

Last published at: February 8th, 2019

cPanel / WHM provides a very basic 'Preview URL' which looks similar to... http:1.1.1.1/~username This has a few limitations however...

  • 'Rewrites' in the .htaccess files don't really work as expected and generally causes issues with the display of sites powered by WordPress, Joomla etc
  • To view a WordPress site via the preview URL, you would need to amend the URL's in the Settings -> General screen of WordPress (far from ideal)
  • Its ugly! Providing this to a potential / development client isn't great, and reveals your servers IP address directly
  • If you don't have WHM, then you have to work the link out! There is no link to this URL from within cPanel itself
  • You can't install an SSL to the temporary URL, therefore if your site uses https:// you can't use it

The Solution

We have developed our own 'Website Preview' plugin for cPanel, which allows you to see your sites, exactly as if the DNS was pointing. It also resolves all of the above quirks! This works by creating an 'Addon' domain for your site, which is a subdomain of your servers hostname (username.server.cloudns.io)

WordPress

By default, just using an Addon domain would still cause problems with redirects / the configured URL of WordPress. As such, we needed a solution for this. We have developed our plugin to automatically detect, and patch your wp-config.php file automatically, allowing the preview URL to work perfectly.

How to use

Simply go to cPanel -> Domains -> Website Preview