When installing the another instance of WordPress in a subdirectory of the main WordPress website installation folder (for example, https://techjourney.com/2ndWordPress/ been the second WordPress instance), and with custom URL structure for permalinks enabled, the WordPress site in the subfolder may have conflict with the permalinks of the main WordPress site on the root folder.

The conflict arises due to incorrect .htaccess written by WordPress in the WordPress installation directory to redirect custom permalinks to their actual access location in WordPress database. Sometimes, the .htaccess may incorrectly written and failed to take into account on the fact that the instance of WordPress is installed in a subdirectory.

For example, most WordPress installation comes with the following .htaccess file:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

The default .htaccess file above does not take into account that the WordPress sub-site is installed in a sub-folder as its site root path. As the result, the WordPress is unable to interpret URL requests that are receiving the sub-directory level, as the requests are handled by .htaccess on the main root directory instead. As the result, 404 page not found error is returned as obviously the main WordPress installation does not know about the pages or posts in another instance of WordPress.

To fix the issue, just modify the .htaccess for the WordPress site in the subdirectory to include the subfolder name. For example:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /subdirectory/
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /subdirectory/index.php [L]
</IfModule>
# END WordPress