Change Primary Site MS
March 12, 2025 · AI Conversations
—
### **Step 1: Backup Everything**
Before making any changes, ensure you have a complete **backup** of your database and files.
—
### **Step 2: Update the Primary Site in the Database**
1. **Access the Database**
– Open **phpMyAdmin** (or use MySQL CLI).
– Select your **WordPress database**.
2. **Modify the `wp_site` Table**
– Locate the `wp_site` table.
– Find the entry where your current primary site is listed.
– Change the `domain` field to the domain of the new primary site.
3. **Modify the `wp_blogs` Table**
– Locate the `wp_blogs` table.
– Identify the blog ID of the new primary site (usually in the `blog_id` column).
– Set `public` to `1` for the new primary site.
– Ensure the old primary site's `public` value is updated appropriately.
4. **Update `wp_options` Table for New Primary Site**
– Locate the `wp__options` table (where “ is the new primary site’s blog ID).
– Update the following rows:
– `siteurl` → Set to your new primary site’s URL.
– `home` → Set to your new primary site’s URL.
5. **Update `wp_sitemeta` Table**
– Locate the `wp_sitemeta` table.
– Find the `meta_key` named `site_admins` and update it if necessary.
—
### **Step 3: Update wp-config.php**
1. Open the **wp-config.php** file.
2. Update or add this line:
define('DOMAIN_CURRENT_SITE', 'yournewprimarysite.com');
3. Save the file.
—
### **Step 4: Update .htaccess**
If your multisite uses subdomains or subdirectories, ensure `.htaccess` is properly configured. WordPress usually handles this, but if necessary, regenerate permalinks by visiting **Settings → Permalinks** in the admin panel.
—
### **Step 5: Clear Cache & Test**
– Flush any caching (Cloudflare, plugins, browser).
– Log in to your **Network Admin Dashboard** and check if the changes reflect properly.
—
After completing these steps, your **new primary site should be active** in the WordPress Multisite network. Let me know if you face any issues! 🚀
—
### **Step 1: Find the Blog ID of the New Primary Site**
1. Open **phpMyAdmin** or connect to your MySQL database.
2. Locate the `wp_blogs` table.
3. Find the Blog ID (`blog_id`) of the site you want to make the new primary site.
—
### **Step 2: Update the Primary Site's Blog ID**
#### **1. Update `wp_site` Table**
– Go to the `wp_site` table.
– If there's an entry for `blog_id`, update it with the new site's Blog ID.
#### **2. Update `wp_sitemeta` Table**
– Find the `meta_key` named `site_id`.
– Change its `meta_value` to the new **Blog ID**.
#### **3. Update `wp_options` Table of the New Primary Site**
– Open the `wp__options` table.
– Update the following values:
UPDATE wp_<new_blog_id>_options
SET option_value = 'https://your-new-primary-site.com'
WHERE option_name IN ('siteurl', 'home');
—
### **Step 3: Update `wp-config.php`**
1. Open **wp-config.php**.
2. Update the following line:
define('BLOG_ID_CURRENT_SITE', new_blog_id);
Replace `new_blog_id` with the correct Blog ID.
—
### **Step 4: Clear Cache and Test**
– Clear any caching (Cloudflare, plugins, browser).
– Log in to **Network Admin** and verify that the new site is the primary site.
—
### **Step 5: Verify and Fix Redirects (if needed)**
If your multisite uses subdirectories or subdomains, ensure `.htaccess` and domain mapping settings are updated.
After completing these steps, your new **Blog ID will be set as the primary site** in your WordPress Multisite network. 🚀 Let me know if you need further assistance!
### **1. Open the Terminal**
Press **`Ctrl + Alt + T`** to open the terminal.
### **2. Edit the Hosts File**
Run the following command to open the hosts file in the **nano** text editor:
sudo nano /etc/hosts
– You may need to enter your **password**.
### **3. Modify the Hosts File**
– The file will look something like this:
127.0.0.1 localhost
127.0.1.1 your-hostname
– You can add custom domain mappings, such as:
127.0.0.1 mycustomsite.local
### **4. Save and Exit**
– After making changes, press **`Ctrl + X`** to exit.
– Press **`Y`** and then **`Enter`** to save.
### **5. Flush DNS Cache (Optional)**
If changes do not take effect, flush the DNS cache using:
sudo systemd-resolve --flush-caches
or
sudo service network-manager restart
Now, your **hosts file is updated!** 🚀 Let me know if you need further assistance.
—
## **Step 1: Backup Everything**
Before proceeding, take a **full backup** of your **database and files**.
—
## **Step 2: Update wp-config.php**
1. Open the **wp-config.php** file.
2. Locate this line:
define('SUBDOMAIN_INSTALL', true);
3. Change it to:
define('SUBDOMAIN_INSTALL', false);
4. Save the file.
—
## **Step 3: Update .htaccess**
1. Open the `.htaccess` file in the root WordPress directory.
2. Replace the current Multisite rules with the following for **subfolder structure**:
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
# Add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(.*)$ index.php?/$1 [L]
3. Save the file.
—
## **Step 4: Update Database**
1. Open **phpMyAdmin** or connect to your database via MySQL.
2. Locate the **`wp_sites`** table:
– Ensure all site URLs use the **main domain** (no subdomains).
3. Locate the **`wp_blogs`** table:
– Update the `path` column to reflect the **new subfolder structure** instead of subdomains.
4. Update the **`wp_options`** and **`wp_sitemeta`** tables:
– Look for `home`, `siteurl`, and `upload_path` options.
– Replace subdomains with subfolders.
Run this SQL query to find and replace:
UPDATE wp_blogs SET path = REPLACE(path, '.yourdomain.com/', '/');
UPDATE wp_options SET option_value = REPLACE(option_value, '.yourdomain.com', '');
UPDATE wp_sitemeta SET meta_value = REPLACE(meta_value, '.yourdomain.com', '');
*(Replace `yourdomain.com` with your actual domain.)*
—
## **Step 5: Flush Cache & Permalinks**
1. Log in to **WordPress Network Admin**.
2. Navigate to **Settings → Permalinks** and click **Save Changes** (without changing anything).
3. Clear any caching plugins, browser cache, and Cloudflare (if used).
—
## **Step 6: Test Your Multisite**
– Open different sites in the network and check if they work under the **new subfolder structure**.
– If any URLs are still redirecting
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} (googlebot|bingbot|baiduspider|yandex|duckduckbot) [NC]
RewriteRule .* – [F,L]
Header set X-Robots-Tag "noindex, nofollow"
# New rule to override robots.txt
RewriteEngine On
RewriteRule ^robots.txt$ robots.txt [L]
# End: Block all search engine bots from accessing the site – (Do not Edit)
# BULLETPROOF 6.9 SECURE .HTACCESS
# CUSTOM CODE TOP PHP/PHP.INI HANDLER/CACHE CODE
# PHP/php.ini handler htaccess code
AddHandler application/x-httpd-php74 .php .php5 .php4 .php3
# TURN OFF YOUR SERVER SIGNATURE
# Suppresses the footer line server version number and ServerName of the serving virtual host
ServerSignature Off
# DO NOT SHOW DIRECTORY LISTING
# Disallow mod_autoindex from displaying a directory listing
# If a 500 Internal Server Error occurs when activating Root BulletProof Mode
# copy the entire DO NOT SHOW DIRECTORY LISTING and DIRECTORY INDEX sections of code
# and paste it into BPS Custom Code and comment out Options -Indexes
# by adding a # sign in front of it.
# Example: #Options -Indexes
Options -Indexes
# DIRECTORY INDEX FORCE INDEX.PHP
# Use index.php as default directory index file. index.html will be ignored.
# If a 500 Internal Server Error occurs when activating Root BulletProof Mode
# copy the entire DO NOT SHOW DIRECTORY LISTING and DIRECTORY INDEX sections of code
# and paste it into BPS Custom Code and comment out DirectoryIndex
# by adding a # sign in front of it.
# Example: #DirectoryIndex index.php index.html /index.php
DirectoryIndex index.php index.html /index.php
# BRUTE FORCE LOGIN PAGE PROTECTION
# PLACEHOLDER ONLY
# Use BPS Custom Code to add Brute Force Login protection code and to save it permanently.
# See this link: https://forum.ait-pro.com/forums/topic/protect-login-page-from-brute-force-login-attacks/
# for more information.
# BPS ERROR LOGGING AND TRACKING
# Use BPS Custom Code to modify/edit/change this code and to save it permanently.
# BPS has premade 400 Bad Request, 403 Forbidden, 404 Not Found, 405 Method Not Allowed and
# 410 Gone template logging files that are used to track and log 400, 403, 404, 405 and 410 errors
# that occur on your website. When a hacker attempts to hack your website the hackers IP address,
# Host name, Request Method, Referering link, the file name or requested resource, the user agent
# of the hacker and the query string used in the hack attempt are logged.
# All BPS log files are htaccess protected so that only you can view them.
# The 400.php, 403.php, 404.php, 405.php and 410.php files are located in /wp-content/plugins/bulletproof-security/
# The 400, 403, 405 and 410 Error logging files are already set up and will automatically start logging errors
# after you install BPS and have activated BulletProof Mode for your Root folder.
# If you would like to log 404 errors you will need to copy the logging code in the BPS 404.php file
# to your Theme's 404.php template file. Simple instructions are included in the BPS 404.php file.
# You can open the BPS 404.php file using the WP Plugins Editor or manually editing the file.
# NOTE: By default WordPress automatically looks in your Theme's folder for a 404.php Theme template file.
ErrorDocument 400 /wp-content/plugins/bulletproof-security/400.php
ErrorDocument 401 default
ErrorDocument 403 /wp-content/plugins/bulletproof-security/403.php
ErrorDocument 404 /404.php
ErrorDocument 405 /wp-content/plugins/bulletproof-security/405.php
ErrorDocument 410 /wp-content/plugins/bulletproof-security/410.php
# DENY ACCESS TO PROTECTED SERVER FILES AND FOLDERS
# Use BPS Custom Code to modify/edit/change this code and to save it permanently.
# Files and folders starting with a dot: .htaccess, .htpasswd, .errordocs, .logs
RedirectMatch 403 .(htaccess|htpasswd|errordocs|logs)$
# WP REWRITE LOOP START
RewriteEngine On
RewriteRule .* – [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index.php$ – [L]
# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]
# REQUEST METHODS FILTERED
# If you want to allow HEAD Requests use BPS Custom Code and copy
# this entire REQUEST METHODS FILTERED section of code to this BPS Custom Code
# text box: CUSTOM CODE REQUEST METHODS FILTERED.
# See the CUSTOM CODE REQUEST METHODS FILTERED help text for additional steps.
RewriteCond %{REQUEST_METHOD} ^(TRACE|DELETE|TRACK|DEBUG) [NC]
RewriteRule ^(.*)$ – [F]
RewriteCond %{REQUEST_METHOD} ^(HEAD) [NC]
RewriteRule ^(.*)$ /wp-content/plugins/bulletproof-security/405.php [L]
# PLUGINS/THEMES AND VARIOUS EXPLOIT FILTER SKIP RULES
# To add plugin/theme skip/bypass rules use BPS Custom Code.
# The [S] flag is used to skip following rules. Skip rule [S=12] will skip 12 following RewriteRules.
# The skip rules MUST be in descending consecutive number order: 12, 11, 10, 9…
# If you delete a skip rule, change the other skip rule numbers accordingly.
# Examples: If RewriteRule [S=5] is deleted than change [S=6] to [S=5], [S=7] to [S=6], etc.
# If you add a new skip rule above skip rule 12 it will be skip rule 13: [S=13]
# CUSTOM CODE PLUGIN/THEME SKIP/BYPASS RULES
# WPBakery Visual Composer plugin skip/bypass rule
RewriteCond %{REQUEST_URI} ^/wp-content/plugins/js_composer/ [NC]
RewriteRule . – [S=15]
# WooCommerce shop, cart, checkout & wishlist URI skip/bypass rule
RewriteCond %{REQUEST_URI} ^.*/(shop|cart|checkout|wishlist).* [NC]
RewriteRule . – [S=14]
# WooCommerce order & wc-ajax= Query String skip/bypass rule
RewriteCond %{QUERY_STRING} .*(order|wc-ajax=).* [NC]
RewriteRule . – [S=13]
# Adminer MySQL management tool data populate
RewriteCond %{REQUEST_URI} ^/wp-content/plugins/adminer/ [NC]
RewriteRule . – [S=12]
# Comment Spam Pack MU Plugin – CAPTCHA images not displaying
RewriteCond %{REQUEST_URI} ^/wp-content/mu-plugins/custom-anti-spam/ [NC]
RewriteRule . – [S=11]
# Peters Custom Anti-Spam display CAPTCHA Image
RewriteCond %{REQUEST_URI} ^/wp-content/plugins/peters-custom-anti-spam-image/ [NC]
RewriteRule . – [S=10]
# Status Updater plugin fb connect
RewriteCond %{REQUEST_URI} ^/wp-content/plugins/fb-status-updater/ [NC]
RewriteRule . – [S=9]
# Stream Video Player – Adding FLV Videos Blocked
RewriteCond %{REQUEST_URI} ^/wp-content/plugins/stream-video-player/ [NC]
RewriteRule . – [S=8]
# XCloner 404 or 403 error when updating settings
RewriteCond %{REQUEST_URI} ^/wp-content/plugins/xcloner-backup-and-restore/ [NC]
RewriteRule . – [S=7]
# BuddyPress Logout Redirect
RewriteCond %{QUERY_STRING} action=logout&redirect_to=http%3A%2F%2F(.*) [NC]
RewriteRule . – [S=6]
# redirect_to=
RewriteCond %{QUERY_STRING} redirect_to=(.*) [NC]
RewriteRule . – [S=5]
# Login Plugins Password Reset And Redirect 1
RewriteCond %{QUERY_STRING} action=resetpass&key=(.*) [NC]
RewriteRule . – [S=4]
# Login Plugins Password Reset And Redirect 2
RewriteCond %{QUERY_STRING} action=rp&key=(.*) [NC]
RewriteRule . – [S=3]
# CUSTOM CODE TIMTHUMB FORBID RFI and MISC FILE SKIP/BYPASS RULE
# TIMTHUMB FORBID RFI and MISC FILE SKIP/BYPASS RULE
# Use BPS Custom Code to modify/edit/change this code and to save it permanently.
# Remote File Inclusion (RFI) security rules
# Note: Only whitelist your additional domains or files if needed – do not whitelist hacker domains or files
RewriteCond %{QUERY_STRING} ^.*(http|https|ftp)(%3A|:)(%2F|/)(%2F|/)(w){0,3}.?(blogger|picasa|blogspot|tsunami|petapolitik|photobucket|imgur|imageshack|wordpress.com|img.youtube|tinypic.com|upload.wikimedia|kkc|start-thegame).*$ [NC,OR]
RewriteCond %{THE_REQUEST} ^.*(http|https|ftp)(%3A|:)(%2F|/)(%2F|/)(w){0,3}.?(blogger|picasa|blogspot|tsunami|petapolitik|photobucket|imgur|imageshack|wordpress.com|img.youtube|tinypic.com|upload.wikimedia|kkc|start-thegame).*$ [NC]
RewriteRule .* index.php [F]
#
# Example: Whitelist additional misc files: (example.php|another-file.php|phpthumb.php|thumb.php|thumbs.php)
RewriteCond %{REQUEST_URI} (timthumb.php|phpthumb.php|thumb.php|thumbs.php) [NC]
# Example: Whitelist additional website domains: RewriteCond %{HTTP_REFERER} ^.*(YourWebsite.com|AnotherWebsite.com).*
RewriteCond %{HTTP_REFERER} ^.*studcosystems.com.au.*
RewriteRule . – [S=1]
# CUSTOM CODE BPSQSE BPS QUERY STRING EXPLOITS
# BEGIN BPSQSE BPS QUERY STRING EXPLOITS
# The libwww-perl User Agent is forbidden – Many bad bots use libwww-perl modules, but some good bots use it too.
# Good sites such as W3C use it for their W3C-LinkChecker.
# Use BPS Custom Code to add or remove user agents temporarily or permanently from the
# User Agent filters directly below or to modify/edit/change any of the other security code rules below.
RewriteCond %{HTTP_USER_AGENT} (havij|libwww-perl|wget|python|nikto|curl|scan|winhttp|clshttp|loader) [NC,OR]
RewriteCond %{HTTP_USER_AGENT} (%0A|%0D|%27|%3C|%3E|%00) [NC,OR]
RewriteCond %{HTTP_USER_AGENT} (;||'|"|)|(|%0A|%0D|%22|%27|%28|%3C|%3E|%00).*(libwww-perl|wget|python|nikto|curl|scan|winhttp|HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner) [NC,OR]
RewriteCond %{THE_REQUEST} (?|*|%2a)+(%20+|\s+|%20+\s+|\s+%20+|\s+%20+\s+)(http|https)(:/|/) [NC,OR]
RewriteCond %{THE_REQUEST} etc/passwd [NC,OR]
RewriteCond %{THE_REQUEST} cgi-bin [NC,OR]
RewriteCond %{THE_REQUEST} (%0A|%0D|\r|\n) [NC,OR]
RewriteCond %{REQUEST_URI} owssvr.dll [NC,OR]
RewriteCond %{HTTP_REFERER} (%0A|%0D|%27|%3C|%3E|%00) [NC,OR]
RewriteCond %{HTTP_REFERER} .opendirviewer. [NC,OR]
RewriteCond %{HTTP_REFERER} users.skynet.be.* [NC,OR]
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=(http|https):// [NC,OR]
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=(..//?)+ [NC,OR]
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=/([a-z0-9_.]//?)+ [NC,OR]
RewriteCond %{QUERY_STRING} =PHP[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} [NC,OR]
RewriteCond %{QUERY_STRING} (../|%2e%2e%2f|%2e%2e/|..%2f|%2e.%2f|%2e./|.%2e%2f|.%2e/) [NC,OR]
RewriteCond %{QUERY_STRING} ftp: [NC,OR]
RewriteCond %{QUERY_STRING} (http|https): [NC,OR]
RewriteCond %{QUERY_STRING} =|w| [NC,OR]
RewriteCond %{QUERY_STRING} ^(.*)/self/(.*)$ [NC,OR]
RewriteCond %{QUERY_STRING} ^(.*)cPath=(http|https)://(.*)$ [NC,OR]
RewriteCond %{QUERY_STRING} (|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} (|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} (|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} (|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} (|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} (|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} (|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} (|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} base64_encode.*(.*) [NC,OR]
RewriteCond %{QUERY_STRING} base64_(en|de)code[^(]*([^)]*) [NC,OR]
RewriteCond %{QUERY_STRING} GLOBALS(=|[|%[0-9A-Z]{0,2}) [OR]
RewriteCond %{QUERY_STRING} _REQUEST(=|[|%[0-9A-Z]{0,2}) [OR]
RewriteCond %{QUERY_STRING} ^.*((|)||%3c|%3e).* [NC,OR]
RewriteCond %{QUERY_STRING} ^.*(x00|x04|x08|x0d|x1b|x20|x3c|x3e|x7f).* [NC,OR]
RewriteCond %{QUERY_STRING} (NULL|OUTFILE|LOAD_FILE) [OR]
RewriteCond %{QUERY_STRING} (.{1,}/)+(motd|etc|bin) [NC,OR]
RewriteCond %{QUERY_STRING} (localhost|loopback|127.0.0.1) [NC,OR]
RewriteCond %{QUERY_STRING} (|'|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]
RewriteCond %{QUERY_STRING} concat[^(]*( [NC,OR]
RewriteCond %{QUERY_STRING} union([^s]*s)+elect [NC,OR]
RewriteCond %{QUERY_STRING} union([^a]*a)+ll([^s]*s)+elect [NC,OR]
RewriteCond %{QUERY_STRING} -[sdcr].*(allow_url_include|allow_url_fopen|safe_mode|disable_functions|auto_prepend_file) [NC,OR]
RewriteCond %{QUERY_STRING} (;||'|"|)|%0A|%0D|%22|%27|%3C|%3E|%00).*(/*|union|select|insert|drop|delete|update|cast|create|char|convert|alter|declare|order|script|set|md5|benchmark|encode) [NC,OR]
RewriteCond %{QUERY_STRING} (sp_executesql) [NC]
RewriteRule ^(.*)$ – [F]
# END BPSQSE BPS QUERY STRING EXPLOITS
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ – [L]
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*.php)$ $1 [L]
RewriteRule . index.php [L]
# WP REWRITE LOOP END
# DENY BROWSER ACCESS TO THESE FILES
# Use BPS Custom Code to modify/edit/change this code and to save it permanently.
# wp-config.php, bb-config.php, php.ini, php5.ini, readme.html
# To be able to view these files from a Browser, replace 127.0.0.1 with your actual
# current IP address. Comment out: #Require all denied and Uncomment: Require ip 127.0.0.1
# Comment out: #Deny from all and Uncomment: Allow from 127.0.0.1
# Note: The BPS System Info page displays which modules are loaded on your server.
Require all denied
#Require ip 127.0.0.1
Order Allow,Deny
Deny from all
#Allow from 127.0.0.1
# HOTLINKING/FORBID COMMENT SPAMMERS/BLOCK BOTS/BLOCK IP/REDIRECT CODE
# PLACEHOLDER ONLY
# Use BPS Custom Code to add custom code and save it permanently here.
update here
1. **Are you looking to change** the rules for blocking bots, spam, or search engines?
2. **Do you need to update security settings** for specific files?
3. **Are you trying to enable or disable features** in your multisite setup?
4. **Do you want to modify redirect rules** for
### **Updated `.htaccess` for Subfolder Multisite**
Replace the **existing WordPress rewrite rules** in your `.htaccess` file with this:
# BEGIN WordPress Multisite (Subfolder)
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
# Add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]
# Skip files and directories
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
# Rewrite for subfolder multisite
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*.php)$ $2 [L]
RewriteRule . index.php [L]
# END WordPress Multisite (Subfolder)
### **Next Steps**
1. **Update `wp-config.php`**
Ensure your `wp-config.php` has:
define('SUBDOMAIN_INSTALL', false);
2. **Flush Permalinks**
– Log in to **WordPress Network Admin**.
– Navigate to **Settings → Permalinks**.
– Click **Save Changes** (without changing anything).
After these updates, your **WordPress Multisite** should now work with a **subfolder structure** instead of subdomains. 🚀 Let me know if you need further assistance!
—
## **Step 1: Update Multisite Settings in Network Admin**
1. **Login to WordPress Network Admin:**
– Go to **"My Sites" → "Network Admin" → "Sites".**
2. **Edit Each Site’s URL:**
– Click on each site listed under **Sites**.
– Change the **Path** to use the **subfolder structure** instead of subdomains.
– Example:
– **Before:** `https://site1.example.com/`
– **After:** `https://example.com/site1/`
– Save changes.
—
## **Step 2: Update Database Entries for Multisite**
You need to update URLs and paths in the database.
### **1. Update wp_blogs Table**
– Open **phpMyAdmin** or connect to your database.
– Find the `wp_blogs` table.
– Change the `path` column for each site:
UPDATE wp_blogs SET path = REPLACE(path, '.example.com/', '/');
### **2. Update wp_site Table**
– Find the `wp_site` table.
– If there is a `domain` field, ensure it contains only `example.com` (without subdomains).
### **3. Update wp_sitemeta Table**
– Locate the `wp_sitemeta` table.
– Find `siteurl` in the `meta_key` column.
– Ensure the value is `https://example.com` (not using subdomains).
### **4. Update wp_X_options Tables**
– For each subsite, update the `siteurl` and `home` fields.
– Example query for each site (replace `X` with the correct blog ID):
UPDATE wp_X_options SET option_value = 'https://example.com/siteX'
WHERE option_name IN ('siteurl', 'home');
—
## **Step 3: Flush Cache & Permalinks**
1. **Go to Network Admin → Settings → Permalinks.**
2. **Click "Save Changes"** (even without modifications).
3. **Clear WordPress Cache, Cloudflare, or Server Cache** if enabled.
—
### **Final Check**
– Open a subsite in the browser (`https://example.com/site1/`) and see if it loads correctly.
– If needed, clear `.htaccess` and regenerate it by re-saving **Permalinks**.
—
After completing these steps, your **WordPress Multisite should work with a subfolder structure.** 🚀 Let me know if you need further assistance!