Installing WordPress in a subdirectory is a great way to run multiple websites under the same domain without affecting the main site. This guide will walk you through the step-by-step process of installing WordPress in a subdirectory while ensuring proper functionality and SEO optimization.
Step 1: Create a Subdirectory in cPanel
- Log in to cPanel by visiting yourdomain.com/cpanel.
- Navigate to File Manager and open the public_html directory.
- Click +Folder and create a new folder (e.g., blog).
- Your subdirectory’s path will be public_html/blog/ (accessible at yourdomain.com/blog).
Step 2: Download and Upload WordPress
- Visit WordPress.org and download the latest version.
- In cPanel, go to File Manager, open the subdirectory (/blog/), and upload the WordPress ZIP file.
- Right-click the ZIP file and select Extract.
Step 3: Create a Database for WordPress
- In cPanel, go to MySQL® Databases.
- Click Create New Database and enter a name (e.g., wp_blog).
- Scroll down to MySQL Users, create a user, and assign it to the database with All Privileges.
Step 4: Configure the WordPress Installation
- Visit yourdomain.com/blog to start the installation.
- Select your language and click Continue.
- Enter your database details (name, username, password).
- Click Submit → Run the installation.
- Provide your Site Title, Username, Password, and Admin Email, then click Install WordPress.
Step 5: Adjust Permalink & Settings
- Log in to WordPress Admin (yourdomain.com/blog/wp-admin).
- Go to Settings → Permalinks and select an SEO-friendly structure (e.g., Post Name).
- Check General Settings to ensure the Site URL is set correctly to yourdomain.com/blog.