How To Move WordPress From a Subdomain to a Subdirectory With Secure HTTPS Address (Subdomain to Subfolder WordPress Transfer)

Web Development | 0 comments

There are certain instances when you might want to transfer or migrate a wordpress blog from a subdomain on your server to a subfolder instead (for example, from site..net to .net/site). In my case, not only did I need to move a wordpress from a subdomain to a subdirectory, but I also needed to convert everything to a secure website so that all links will point to https:// rather than http:// to satisfy Google. Wanna know how I completed the transfer?

Step-by-step Guide to Transfer WordPress from a Subdomain to a SubFolder or SubDirectory

NOTE: This WordPress move has the following criteria, in case it applies to you:  the subdomain on the server is the same name as the subdirectory that I want my wordpress blog to point to. In essence, the WP files are already in the same directory.  If that’s what you’re looking for, keep reading. For the purposes of this tutorial, the name of the directory for the subdomain and wordpress blog is “site”

STEP (1) Backup all your wordpress files and WP-related database. I always do this before I make any changes just to be on the safe side. You are not going to touch any existing directories during this move, so there’s no need to backup everything else that is not part of your wordpress site/blog.  However, it is always a good idea to complete a full backup, so now would probably be a good time to do so, if you haven’t done a full site backup before.

STEP (2) Login to your WordPress administration panel.  On the sidebar menu, go to “Settings” then click on “General” with your mouse. On the top of the form, you should see an input field with WordPress Address (URL) and Site Address (URL). Go ahead and make the necessary changes, then hit SAVE on the bottom. In this example, I simply changed http://www.site..net to https://www..net/site on both fields.  The WP script will log you out of the admin area. This is normal. Just log back in and you’re good to go.

STEP (3) Review your current permalink structure by going to “Settings” and then to “Permalinks.”  In my case, I didn’t have to change any structures as I wanted everything the same. This also makes things simpler.

STEP (4) Access your server via FTP and go to the directory where your WordPress blog is installed. Modify the htaccess file to this. This will tell the server to read your CSS and image files securely via https. This will help with mixed-content errors that you might get even if you have a valid SSL certificate. Of course, the best way will be to modify the html codes of your WordPress theme to point everything to https rather than http. I would save a backup of the existing htaccess file just to be on the safe side before making changes.

# BEGIN WordPress

RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . site/index.php [L]

# END WordPress

STEP (5) Login to cPanel. If you don’t know the address to cPanel of your server, ask your web hosting provider for these details. You will need your username and password provided by your host to login. Once inside, find the section for Domains. Click on” SubDomains. ” On the page, you should then see a section that says “Modify a Subdomain.” Find the subdomain that currently has your wordpress files. In this example, the subdomain would be site. Click on edit on the side next to the name of the subdomain. You will get a popup that says “Change Document Root.” In this example, you will see “public_html/site” on the form. You will be using “site” for the subfolder of your WordPress blog, so you will need to change the subdomain to point to another folder. You can create any folder name that does not currently exist on your server. In my example, just changing public_html/site to public_html/site-old will do the trick. Now the subdomain is pointing to another directory (/site-old) and should no longer interfere with the WP files on the ‘site’ folder.

STEP (6).  Login via FTP and create a new htaccess file on your “site-old” directory.  Input the code below on the htaccess file. This will tell browsers to redirect your old WP links from the subdomain http://www.site. and point instead to your new secure address https://www.after5pc.net/site. Why would you want this? The permanent redirection is to ensure you won’t be affected terribly by the new URL changes, especially if your blog is already indexed by Google and has some SEO rankings.

Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^site.after5pc.net [nc]
rewriterule ^(.*)$ https://www.after5pc.net/site/$1 [r=301,nc]

You’re done!  Not too bad right? It took me hours to figure this out, but I decided to write this article to save someone all the trouble I went through. Hope it helps!

Hire Me to Change Your WordPress Directory

If you’d rather not mess with the above steps and would rather hire a professional to do the techy stuff for you, just contact me and I’ll respond with a quote.

 

You May Also Like

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Categories

Powerful SMS Mass Texting System For Your Organization

Use my incredible AFTER5PC SMS system to TRANSFORM your existing Android phone into a POWERFUL mass texting and marketing communication tool! My SMS gateway is perfect for churches, small businesses, and other organizations of all sizes.

Ecommerce + Chatbot + Email + SMS + Social Media Automation

Use this amazing platform to get all the tools that you need in order for your business to succeed online! This powerful all-in-one system is the most cost-effective way to connect to your existing customers or to obtain fresh leads and get more sales!

 CLAIM YOUR COMPLIMENTARY CERTIFICATE

Limited-Time Special Offer For New Web Design Clients  

$1,000 OFF RESTAURANTS AND GROCERIES

Enjoy $1,000 worth of coupons from your choice of favorite restaurants and fast good chains, plus grocery coupons of your choice! These are restaurants such as TGIF Fridays, Chili’s, Olive Garden, Red Lobster, Applebee’s, Sizzler, I-Hop, Denny’s just to list a few. Also includes fast food chains such as McDonald's, Hardee's, Quizno's, Taco Bell, Dairy Queen, Burger King, Carl's Jr., Jack-In-The-Box and many more. Plus, enjoy grocery coupons from a list of national brand name products that will definitely save your family money. Total savings of $1,000! This offer is valid for USA residents only.