How to access WordPress using your server URL

If you’re migrating your WordPress website from another host or want to develop the site before pointing your domain to your HostPapa server, you can still access your WordPress using your server URL. In this article, we’ll show you how to access WordPress via cPanel.

The HostPapa server URL structure looks like this:

http://servername.com/~cpanel_username/

servername.com” is the hostname of the server where your website is hosted. Your “cpanel_username” can be found in My cPanel when logged into HostPapa Dashboard. Your username is displayed at the top of the page.

My cPanel

Before you can access WordPress via your server URL, you’ll need to make some changes to your configuration.

  1. Log in to your HostPapa Dashboard.

HostPapa Dashboard

2. Select My cPanel.

My cPanel Menu

3. Scroll down and select phpMyAdmin in the Databases section.

phpMyAdmin icon

4. In phpMyAdmin, find and select your WordPress database in the left sidebar.

5. If you don’t know which database is being used for WordPress, open your wp_config.php in cPanel > File Manager and look for the following lines:

// ** MySQL settings - You can get this info from your web host ** //

/** The name of the database for WordPress */

define('DB_NAME', 'xxxx_xxxx');

 

 

 

 

 

 

 

 

 

 

 

The text next to ‘DB_NAME’ is your WordPress database name.

6. Once you’ve selected the database in phpMyAdmin, select the wp_options table. Your database prefix may be different depending on your configuration. In the example below, the table is called wpfk_options.

7. In the right pane, find the siteurl and home options and use the Edit button to change their values to the server URL for your account.

8. Use the Go button at the bottom of the Edit page to save your changes.

9. Close phpMyAdmin.

10. In cPanel > File Manager, open your WordPress .htaccess file for editing. .htaccess is a file used by the Apache webserver, and its rules override global settings for the directory in which the file is placed. You may find that .htaccess files are created automatically on your server when installing popular web applications like WordPress, Drupal, and Magento. If one doesn’t exist already, it can be created in a text editor and uploaded to your server. You can also create one directly from cPanel’s File Manager.

11. When you open File Manager, click Settings.

cPanel File Manager Settings

12. .htaccess files are hidden from view by default. To expose them, ensure Show Hidden Files (dotfiles) is checked in the Preferences panel, then click Save.

Show Hidden Files option

13. Navigate to your WordPress folder using the left sidebar and locate the .htaccess file.

cPanel File Manager

14. Highlight the file and select Edit at the top of the screen.

15. In the file editor, look for the default rewrite rules:

# BEGIN WordPress

<IfModule mod_rewrite.c>

RewriteEngine On

RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . /index.php [L]

</IfModule>

# END WordPress

Edit the rules to include your cPanel username, as follows:

# 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]

</IfModule>

# END WordPress

 

Editing .htaccess

You can now access your WordPress website using your server URL.

Server URL

16. Remember to reverse the changes you’ve made once your site is ready to go live.

Alternative method

If you don’t want to use phpMyAdmin, you can edit your wp-config.php file directly using the following steps. 

  1. Open your wp_config.php in cPanel > File Manager and add the following lines:
define('WP_HOME','http://servername.com/~cpanel_username/');
define('WP_SITEURL','http://servername.com/~cpanel_username/');

 

 

 

 

 

 

2. Save the file and then, as in the previous example, edit your .htaccess file with the updated rewrite rule:

# 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]

</IfModule>

# END WordPress

3. Once again, remember to reverse these changes when you point your domain to your new WordPress site.

If you need help with your HostPapa account, please open a support ticket from your dashboard.

Related Articles