1. Home
  2. Knowledge Base
  3. Applications
  4. Wordpress
  5. Running WordPress from a Subdomain or Subdirectory

Running WordPress from a Subdomain or Subdirectory

Step 1: Login to WordPress dashboard.
Step 2: In the WordPress menu (on the left side of the page) navigate to Settings > General and change the Site Address (URL) to your main domain name (e.g. http://yourdomain.com). Leave the WordPRess Address (URL) as it is, it should not be changed. Click the Save Changes button at the bottom of the page. Don’t worry if you see an error message, and do not try to view your site just yet (you’ll likely get an error message there too).
Step 3: Log out of your WordPress dashboard.
Step 4: Using either the cPanel File Manager or a stand alone FTP program, COPY the index.php and .htaccess files from the subdomain or subdirectory into the site’s document root folder. This will be public_html for the account’s main domain name, while Addon domains be something similar to public_html/addondomain.com. Make sure you copy these files, do not move them.
Step 5: In the cPanel FIle Manager, open your index.php file that you just copied to public_html to edit it. You can open the file for editing by clicking on the file and then selecting Code Edit or Edit in the menu at the top of the page or right clicking the file and selecting either Code Edit or Edit in the menu that appears. If you receive an Encoding Check pop up window, make sure utf-8 is selected as the character encoding.

Step 6: Near the end of the file, locate the line that reads:


Edit this to point to the directory where you originally installed WordPress (e.g. /blog/wp-blog-header.php:


Now you’re ready to log back into your WordPress dashboard once again. The link to wp-admin will not change from the original (e.g. blog.yourdomain.com/wp-admin or yourdomain.com/blog/wp-admin).

Step 7: If you are using Permalinks, navigate to Settings > Permalinks. Change your Permalinks to any other setting and click the Save Changes button. Now change them back to your preferred Permalinks structure and click Save Changes again. This will reset your Permalinks so all of your site’s links should be updated now.

Related Articles