How to Develop your WordPress Site Using a Temporary Alias and then Push it Live
The URL for your WordPress site is controlled through the database and optionally, the wp-config.php file.
In the Database
The image below shows the General Settings page for a WordPress blog. The WordPress Address and Site Address are the boxes that control the URL in the database.
The WordPress Address (URL) is the URL you want people to type when they visit your site. For example, 'http://domain.com'.
The Site Address (URL) defines where the core files for WordPress actually reside. For example, 'http://domain.com/wordpress'. This is used if you have installed your site in somewhere other than the root folder. It points the web server to the correct directory to serve your files.
In the 'wp-config.php' File:
These options can also be manually set in your wp-config.php file. NOTE: If the options are set in your wp-config.php file, you will not be able to access them through the General Settings page on the site.To set the URLs in your wp-config.php file, you will need to edit it through your Control Panel's file manager and add the following two lines:
This is not the best option, because it is just hard-coding the URLs for your site. This is an optional approach, and is an alternative to switching the Home and Site URL on your settings page or directly in the database for your site.
How Temporary URLs Work in WordPress
In our environment, we set up your WordPress site in the root of the site, and not in a sub-directory. This means that your WordPress site is accessible at your domain name without needing special redirect rules to cut out '/blog/' or '/wordpress/' from your URLs because both the Home URL and Site URL are the same; they point to the root of your site.
For example, your site would always be accessible at 'http://yourdomainname.com', and links would look similar to 'http://yourdomainname.com/sample-page/' (NOTE: this example is using Pretty Permalinks).
This makes temporary URLs easy to set up and maintain for your site. If you are moving to our environment, we automatically set up a temporary URL for your site, and it allows you to access and make edits to your site before bringing it live on our servers. This temporary URL will look like this, 'http://yourdomainname.com.tempdomain.com' and the same page using Pretty Permalinks would look like this 'http://yourdomainname.com.tempdomain.com/sample/'
To work on your website before it is live in DNS, point your browser to http://yourdomain.com.tempdomain.com/wp-admin. Log in and develop your website.
When you are ready to bring your site live, and are finished using the temporary alias, you can follow the instructions in this article, How to Bring Your Site Live with Managed.com, to switch the DNS records for your site to point at our servers.
You will also need to contact support to switch the URLs for your site from the temporary domain to the primary domain name if you are not comfortable modifying your site's database. If you are familiar with phpMyAdmin and want to change references to the temporary aliases, follow the steps below.
Be sure to back up your database before following the steps below!
- Log into your website's control panel.
- Open phpMyAdmin. If needed see How to Access phpMyAdmin.
- Expand the site's database.
- Click the SQL tab.
- Paste the following code in the SQL query on database field box.
UPDATE wp_posts SET post_content = REPLACE (post_content, 'http://[WEBSITE].com.tempdomain.com', 'http://[WEBSITE].com');
- Replace [WEBSITE] with your domain's name.
- Click Go.
- Any absolute references for images will be switched in your database to reflect your domain's name without the temporary alias.
Article ID: 2041, Created: September 25, 2014 at 2:55 PM, Modified: April 24, 2015 at 10:15 PM