Search code examples
apachewordpress.htaccessdirectorypermalinks

Hide a recurring folder


For some reason, I keep getting an empty folder called "blog" generated on my server. No idea why, I've asked on the WP.org forum, but to no avail - http://wordpress.org/support/topic/directory-being-created?replies=14

This screws up my pretty permalinks, since instead of the link to /blog showing my blog, it just shows an empty folder.

Whilst I wait to resolve my issue, is there a way to make .htaccess forward the blog folder url to my actual blog page?

Current .htaccess below:

RewriteEngine on

# 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

Solution

  • Modify your .htaccess to include the following

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d [OR]
    #if it is the blog folder also send it to WordPress
    RewriteCond %{REQUEST_URI} ^/blog/?
    RewriteRule . /index.php [L]