Permalinks not working on second wordpress installed in a subdirect

I have a main wordpress installed on the root and now due to a long story about incompatible plugins I need to install a second full instance of wordpress in a subdirectory.

The main site works fine, as does the site in the subdirectory. As long as I don't activate pretty permalinks on the subsite

Once the subsite has permalinks on only the home page is accessible, any other page is captured by the main install that spits out a 404.

I have the following on my main .htaccess (in the root folder of the site)

IfModule mod_rewrite.c
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^domain.com
RewriteRule (.*) http://www.domain.com/$1 [R=301,L]
SecFilterEngine Off
SecFilterScanPOST Off
/IfModule


# 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

Directory /path/to/subdir
RewriteEngine On
RewriteBase /subdir/
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /subdir/index.php [L]
/Directory

And this is the content of the .htaccess that resides in the subfolder

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

I thought that either the .htaccess in the subdirectory or the Directory directive in the main .htaccess would work. I'm clueless at this point.

Topic directory htaccess Wordpress

Category Web


Can you please create a subdomain? Your sub directory will be point via subdomain with fresh htaccess file. And i hope the following code is not in your sub directory.

RewriteCond %{HTTP_HOST} ^example.com

RewriteRule (.*) http://www.example.com/$1 [R=301,L]

Most of the time this problem gets solved after flushing the permalinks. By that I mean, one just needs to hit 'Save changes' on 'Permalink settings' page on backend. However you said that you tried pretty permalinks and its not working.

Under "Settings > General", please confirm that you have updated "WordPress Address (URL)" and "Site Address (URL)" to subdirectory.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.