I have a wordpress blog that is installed on the root of my domain.

I have put another piece of software in a subdirectory.

When I try to access the subdirectory (http://www.blah.com/abc) I get a 404 error from wordpress.

I've done some reading and it looks like I need to have a rewritecond and a rewrite rule before the rewritebase below:

# BEGIN WordPress
<IfModule mod_rewrite.c>
 RewriteEngine On

RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

But I have no clue what I need there.


END WordPress


RewriteCond %{REQUEST_FILENAME} !-f

Says that if a file exists with that name, do not rewrite it.

RewriteCond %{REQUEST_FILENAME} !-d

Says that if a directory exists with that name, do not rewrite it.

So your .htaccess should be all set already. Check the permissions on your new directory to make sure it is readable by the webserver (i.e. 755 or similar) and do the same with the files in the directory.

| improve this answer | |

Indeed, you want to prevent rewriting if /abc is requested. The additionnal RewriteCond should be :

   RewriteCond %{REQUEST_URI}!^/abc/  

Place it right before the existing RewriteRule line. It means the requested URI should not start with "/abc/" for the following rule to be applied.

| improve this answer | |
  • That gives me an internal server error. I copy/pasted that into my htaccess and changed abc to the name of my folder. – GeoffreyF67 Dec 21 '09 at 21:07
  • What error do you have in the logs ? I just realized the htaccess file you posted should already not rewrite /abc if the directory exists at the root of your web directory because of the second RewriteCond. – François Feugeas Dec 21 '09 at 21:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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