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.
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.
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.
Name Servers on SiteGround
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.
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 .htaccess and index.php then copy index.php to the folder (eg. blog) 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?