How to access WordPress using your server URL?

Before building a WordPress site using your server URL, first, understand the structure of a server URL. The server URL of a primary domain name looks something like this:

http://servername.com/~cpanel_username/

Here, 'servername.com' denotes the hostname of the server on which your account is located and the 'cpanel_username' denotes the panel name of your account.

To check the account's server name or cPanel username, go to User area > My accounts > Information and settings page.

In the WordPress, database changes the siteurl and home options. You can also change these options inside the phpMyAdmin via cPanel.

In the phpMyAdmin select the WordPress database. Go to the wp_options table. (The prefix may be different for you, eg. wordpress_options)

Search for the options siteurl and home. Change their values to the server URL of your account.

Information about the database related to WordPress installation can be found inside the file named wp-config.php. The wp-config.php file can be found inside the WordPress root/installation folder.

To open File manager in cPanel, search for the line as given below:

define('DB_NAME', 'database_name');

Then, you need to update the WordPress rewrite rules inside the website's .htaccess file so that they will match the new URL.

# BEGIN WordPress

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress


Change these to:

# BEGIN WordPress

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

# END WordPress


In this case, the 'cpanel_username' denotes your cPanel username.

Now by making all of these changes in the .htaccess file you can build a WordPress website using your server URL.

Did you find this article useful?