Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

notjustjay

macrumors 603
Original poster
Sep 19, 2003
6,056
167
Canada, eh?
Howdy folks! I could really use some help from someone who knows their way around .htaccess files better than I do.

I have a WordPress site installed at http://www.cherith.ca/site. Thanks to the magic of .htaccess, the site can be accessed with only the root path (http://www.cherith.ca/page/tree instead of http://www.cherith.ca/site/page/tree). I followed these directions to set that up.

Unfortunately, the .htaccess forwarding rules seem to break a few sections of the site that are password-protected with .htpasswd. Instead of stopping to ask the user for login credentials, it goes ahead and tries to forward to the WordPress site, which leads to a 404 error.

e.g. http://www.cherith.ca/wiki -- a password protected directory, fails (takes you to the 404 page).

http://www.cherith.ca/test -- an empty directory I just created, works fine.

I think the answer is to set up an exception list for certain directories, but I haven't been able to code this correctly. Any help would be greatly appreciated!

Here is the contents of the .htaccess file in the root:

Code:
# BEGIN WPSuperCache
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
AddDefaultCharset UTF-8
RewriteCond %{REQUEST_URI} !^.*[^/]$
RewriteCond %{REQUEST_URI} !^.*//.*$
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{QUERY_STRING} !.*=.*
RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$
RewriteCond %{HTTP:X-Wap-Profile} !^[a-z0-9\"]+ [NC]
RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC]
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteCond %{DOCUMENT_ROOT}/site/wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html.gz -f
RewriteRule ^(.*) "/site/wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html.gz" [L]

RewriteCond %{REQUEST_URI} !^.*[^/]$
RewriteCond %{REQUEST_URI} !^.*//.*$
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{QUERY_STRING} !.*=.*
RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$
RewriteCond %{HTTP:X-Wap-Profile} !^[a-z0-9\"]+ [NC]
RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC]
RewriteCond %{DOCUMENT_ROOT}/site/wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html -f
RewriteRule ^(.*) "/site/wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html" [L]
</IfModule>

# END WPSuperCache


# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /site/index.php [L]
</IfModule>

# END WordPress
 
Problem solved!

After an hour of Googling, learning about .htaccess rewrite rules, and puzzling over why various combinations of directory-exclusions weren't working, I finally found a website describing the problem:

http://codyaray.com/2010/08/wordpress-webdav-and-dreamhost

As it turns out, it was a bug (possibly specific to Dreamhost) relating to rewrite rules, .htpasswd and 401 and 403 error handling files, believe it or not!

Thanks anyway guys :)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.