Is your WordPress .htaccess file causing problems with other files?

That’s the issue I ran into. I was building a WordPress site, and put a billing/invoicing app in a subdirectory of the site.

Well, the default rewrite lines (that WordPress added to the site’s htaccess file) were causing major issues for the billing script (AWBS). It was also causing problems with Apache password protecting of a directory. The WordPress rewrite would take over before Apache would invoke the username/password entry box.

It was a big mess. I spent a long time pulling my hair out over the situation.

I tried several things to fix the problem. I searched high and low for anyone with the same issue. Several searches later I found nothing. Then I found a wonderful thread talking of the same issue…along with the needle in the haystack. 🙂

sophistishe on WordPress.org posted a way to get around the problem. With some slight tweaking, it worked!

ErrorDocument 401 /onerror.html
ErrorDocument 403 /onerror.html
ErrorDocument 404 /onerror.html

Options +Indexes
Options +FollowSymLinks

RewriteEngine on

RewriteCond ${HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^www.domain.com
RewriteRule (.*) http://www.domain.com/$1 [L,R=301]

RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule (.*) http://www.domain.com/$1/ [L,R=301]

# BEGIN WordPress

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

# END WordPress