1

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.

2 Answers 2

0

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.

3
  • Thanks for the reply!Under "Setting > General" the site url contains the subdirectory. I have also tried to switch back and forth between different permalink settings but the only one that works is the "Default" option with the query string in the URL. Oct 19, 2014 at 14:12
  • Please make sure that the .htaccess in sub-directory is writable by WordPress Oct 20, 2014 at 15:14
  • I have just checked and it is writable, but wordpress does not change the settings there when I switch from default to pretty permalinks. Oct 21, 2014 at 11:17
0

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]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.