• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

<cmiaral: tech blog?>

What works . . . and not.

  • Home
  • About
  • Tools
  • WordPress Resource
  • Contact
You are here: Home / WordPress / How to Install WordPress in a Directory (Folder)

How to Install WordPress in a Directory (Folder)

Updated on June 6, 2019 By Carol Leave a Comment

Every time I would make a new website (at least every two years), I ask the same question “How can I install WordPress.”

So I did myself a favour of writing the steps on my free word processing software. My future forgetful self will thank me for this day.

Because I’m a neat freak, I also want my websites to be clutter-free. Is that all the reasons? There’s more.

Related Post: Install WordPress on AMPPS (Local Hosting)

Why Should You Install a WordPress in Another Folder

Because I’m a Questioners according to the quiz about Four Tendencies by Gretchen Rubin, I (and you) need to know why this is important.

Is there a way to keep files in the web hosting in order?

Wouldn’t it be nice to have all the WordPress-related files in one folder? (Now I’m continuously answering a question with more questions.)

The point is, it is better to do this now early on because as the website keeps on growing files will be added later on. And it will happen. And you don’t want to regret putting things in the right place from the start when you can still recognize which is which.

The steps are a bit tricky but I made it easy to follow as much as I could. Follow along.

Install WordPress in a Directory

Steps on How to Install WordPress in a Directory

In this tutorial, I installed WordPress on SiteGround, my favourite web hosting, so some terms might be different from your web hosting. But I’m sure you can follow along.

Step 1: Create a database and user on MySQL Databases with your preferred web hosting company.

Step 2: Add the domain on the web hosting.

If you are already have a website and would like to add more websites in the same hosting provider then you have to use the Addon Domains on the cPanel instead.

New Domain Name = samplewebsite.com
Subdomain or FTP Username = samplewebsite
Document Root = public_html/samplewebsite
Password = your password

I follow a similar way of naming the files and websites for every WordPress installation to make the process faster and easier. But, it’s just me, do whatever file naming suits your preference.

Step 3: Configure DNS on a domain name registrar. (I prefer Namecheap.) You can find the two Name Servers on the cPanel of the web hosting provider. To test the setup, use Pingdom DNS check tool.

Name Servers on SiteGround
ns1.siteground336.com
ns2.siteground336.com

Step 4: Download the latest WordPress and install it in the directory (eg. public_html/teamaspin) using FTP such as WinSCP or FileZilla.

Step 5: Edit wp-config-sample.php and rename it to wp-config.php. I use Brackets to edit the file; you can use any text editor that you like.

Add the database name, username, password that you created in Step 1. Also edit table prefix and add salt key by copying it online.

define(‘DB_NAME’, ‘database name goes here’)
define(‘DB_USER’, ‘username goes here’)
define(‘DB_PASSWORD’, ‘password goes here’)
$table_prefix = ‘wprefixhere_’;

I add underscore in the table_prefix for clarity in the database. You’ll see what I mean when you poke inside the table after the installation.

Step 6: Go online (eg. https://samplewebsite.com) to continue the installation.

Note: You can stop here. But if you want to move WordPress in a folder keep on reading.

Step 7:
Log in to your blog and go to Settings > General, change the following information, save and log out.

WordPress Address (URL): https://samplewebsite.com/blog
Site Address (URL): https://samplewebsite.com

The WordPress Address is where you will place all the WordPress-related files so name it whatever you like.

Step 8: Move all the WordPress files in the folder (eg. blog) except then copy .htaccess and index.php to the main directory using FTP.

Step 9: Edit index.php in the main directory (eg. public_html/samplewebsite)

Change “require( dirname( __FILE__ ) . ‘/wp-blog-header.php’ );”
to this “require( dirname( __FILE__ ) . ‘/blog/wp-blog-header.php’ );”

And we are almost done.

Step 10: Go online and check the WordPress site. Ta da. Here you have organized files sitting on the web hosting provider.

We are done installing WordPress in a directory (folder). Sorry to pop your happiness bubble but there are more things to do after the WordPress installation.

For now, let me congratulate you for keeping a tidy virtual closet for your website.

How do you like installing your WordPress website? In another folder or whatever?

Share this:

  • Click to share on Facebook (Opens in new window) Facebook
  • Click to share on X (Opens in new window) X
  • Click to share on Pinterest (Opens in new window) Pinterest
  • Click to share on LinkedIn (Opens in new window) LinkedIn
  • Click to email a link to a friend (Opens in new window) Email
  • Click to print (Opens in new window) Print

Related

« How to Edit the 404 Page in Genesis Sample Child Theme
How to Post from Facebook to Twitter »

Filed Under: WordPress Tagged With: affiliate

About the Author

Carol loves to learn new things that involve technology, mostly about the Internet. If not blogging, she's in the kitchen trying to (at least) make edible vegetarian meal. A toast is always a lifesaver. Connect with her on Twitter and LinkedIn.

Reader Interactions

Leave a ReplyCancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

SUBSCRIBE

Enter your email address to subscribe to cmiaral.com and receive notifications of new posts by email.

ADS

TOP POSTS

  • The iOS 26 Changed the Background Color of Contacts on iPhone

  • Kobo Libra 2 Firmware Updates

  • Is There a Royal Kludge Software for Mac?

  • My Attempt to Fix Boot Device Not Found on HP Stream Laptop

  • How to Remove “kav_agent quit unexpectedly.” Message on Mac

TOPICS

  • Blogging Tips
  • Books
  • Coding
  • Gadgets
  • Hardware
  • Photography
  • Productivity
  • Social Media
  • Software
  • WordPress

COMMENTS

  • Collins PEREIRA on My Attempt to Fix Boot Device Not Found on HP Stream Laptop
  • Carolyn on Tzumi Bluetooth Keyboard with Folio Case, an iPad Mini 2 Accessory
  • FOSU FREDERICK on Tzumi Bluetooth Keyboard with Folio Case, an iPad Mini 2 Accessory
  • Hassan Rabiu on My Attempt to Fix Boot Device Not Found on HP Stream Laptop
  • Karamveer on How to Open Atom in Git Bash (Windows 10)
CMiaral · Copyright © 2016-2025 · Genesis Framework · WordPress
  • Home
  • About
  • Tools
  • Contact
  • Site Map
  • Disclaimer
  • Privacy Policy