Search code examples
wordpress.htaccesspermalinkssubdirectory

WordPress Permalinks not found in subfolder


I have WordPress installed in the root folder and in a subfolder. I can access the home page for the WordPress site in the subdomain, but the permalinks does not work – error 404. I have tried to reset the permalinks, but it did not help. I can’t find any .htaccess file, so I have created one myself and placed it in the subfolder directory:

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

Here is a link to the subfolder WordPress site: http://ninahortendesigns.com/projects/bigsargefitness/

I have set the database options to the above direction.

Thanks for your help.


Solution

  • You will need to look at a few things:

    1. .htaccess file in the root WP site (WP1) and edit it so that WP1 doesn't catch the URLs and generate 404 errors, I'm not sure if that comment assisted, I've used this answer for a similar issue.
    2. .htaccess file in the sub WP site (WP2) and rename it to "htaccess.old" then log into your wp2/wp-admin, go to "Settings->Permalinks" check the URL structure is as desired (it doesn't usually change) and click "Save" at the bottom of the page. This will regenerate your .htaccess file within the context of the sub-directory and you shouldn't get 404 errors when you visit sub-pages like this

    Here's the code from the first link edited so that it should work with your site, although if you have additional rules, you should only insert the line under the comment.

    # BEGIN WordPress
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index.php$ - [L]
    
    # Include in the next line all folders to exclude
    RewriteCond %{REQUEST_URI}  !(projects) [NC]
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    # END WordPress
    

    If you have custom rules, only insert these lines

    # Include in the next line all folders to exclude
    RewriteCond %{REQUEST_URI}  !(projects) [NC]
    

    Assuming you're a designer and are uploading examples of sites you've built, you should only have to do step 2 the next time you upload a new site to the wp1/projects/ sub-directory