Cannot access non-wordpress subdirectories as wordpress overrides them with a 404 error

I’m assuming that you put WordPress in your site root and the external directories are also in your site root. The reason this is happening is that .htaccess files follow a hierarchy. Whatever directives are in the top-level .htaccess file flow down and apply to all directories below it.

If this is the case, you can do one of several things:

  1. Move your WordPress into its own directory.
    See: http://codex.wordpress.org/Moving_WordPress
    If you move WordPress into its own directory so that it is on the same level in your server directory hierarchy as the other directories the WordPress rewrite rules cannot affect the other directories.

  2. RewriteEngine Off – this would normally work. If it isn’t working check that you are not using a wildcard DNS setting. If you have a wildcard * hostname record pointing at your web server in your DNS settings it can cause havoc with .htaccess and subdomains.

  3. In the .htaccess file in your site root, add the following ABOVE the WordPress .htaccess directives:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_URI} ^/subdirectoryname1/(.*)$ [OR]
    RewriteCond %{REQUEST_URI} ^/subdirectoryname2/(.*)$ [OR]
    RewriteRule ^.*$ - [L]
    </IfModule>
    

One of these should work for you.

Leave a Comment