Web Hosting Talk







View Full Version : .htaccess causes 404


ic3d
07-26-2006, 07:43 PM
Hi everyone,

I have a problem when password protecting a folder of a website using .htaccess. I use wordpress on a free-time site and everything works great. However Wordpress comes with an htaccess file in the root that makes it impossible to use htcaccess in a folder outside.

This is the exact htaccess file generated by Wordpress located in the root:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

What i want to work is that
url/restrictedarea/ can use a htaccess password file. It can't now because then i get a 404 not found error.

This is what the htaccess in the folder /restricedarea/ looks like:

#BEGIN RestrictedArea
AuthName "Content Editor Protected Area"
AuthType Basic
AuthUserFile /path/restrictedarea/.htpasswd
Require valid-user
#END RestrictedArea

Path is ofcoarse the correct serverpath to the htpasswd file that is located within the same folder.

Could someone help me out with this issue. I have basicaly no knowledge of htaccess.

tobiasly
07-27-2006, 01:47 PM
The way you are doing it should work. The fact that WordPress has an .htaccess in the parent folder will not prevent the one in the restricted folder from working.

What exactly is the 404 error; perhaps you have one of your paths wrong. Also, Apache only lets .htaccess files configure whatever is allowed by the AllowOverride directive, which is in your httpd.conf file. So you need an "AllowOverride AuthConfig" or "AllowOverride All" somewhere in a parent directory.

http://httpd.apache.org/docs/2.0/mod/core.html#allowoverride

Devin-VST
07-27-2006, 02:33 PM
Do you get the wordpress 404 error, or the apache 404 error? Wordpress's .htaccess just says if the request is not a file or directory, execute index.php

ic3d
07-28-2006, 05:54 AM
Iam getting the Wordpress 404.

Devin-VST
07-28-2006, 08:36 AM
if you don't use URL rewriting in wordpress (makes your links /folder/post/whatever instead of ?p=4545), you should be able to delete the wordpress .htaccess content, just to test if you can actually get to the restricted area. give it a try.

arkin
07-28-2006, 09:05 AM
Sometimes I get errors with .htaccess when using it on windows and I have to remove the <IfModule mod_rewrite.c>.

If your not on windows, ignore what i'm saying.

ic3d
07-29-2006, 07:36 AM
When i remove the .htaccess generated by Wordpress it works like it should work. However, i do need the names in the url..

ic3d
07-31-2006, 08:09 AM
Anyone a solution?

Devin-VST
08-02-2006, 08:36 AM
try posting in the wordpress forums, this seems to be an isolated issue with the WP .htaccess