.htaccess This webpage has a redirect loop?

I think I messed up.

I am currently in the stages of learning .htaccess for, of course, Apache.

I have applied a Password Protection to a directory on my website. I also have different directories that hold different information, that are not protected.

For example:

http://www.example.com/forum/ = Not Protected http://www.example.com/construction/ = Protected

Now I do know that an .htaccess file can apply to an entire website if placed in the root, or you can have a .htaccess file applied to a specific directory.

In the root of...


I used to have a .htaccess file with a 301 Redirect (In The Root Folder) that would translate all requests of example.com and or http://example.com into http://www.example.com. I removed that 301 Redirect completely.

But, for some reason, I am still getting this error message in which I cannot access the... http://www.example.com/forum/ directory.

I have completed all of the following steps to troubleshoot the problem... 1. Cleared Cache/Cookies/Sessions - Completely 2. Flushed the DNS via my Operating System 3. Restarted my computer 4. Have a DNS Service in which provides me the latest DNS Information.

What I am asking is A. How do I remove this message? And B. How do I still translate example.com requests into www.example.com requests without having this problem occur?

Thank you! Let me know, I appreciate the offer that I will receive, Aaron


In your root folder you can still place a .htaccess with the following rule to redirect from example.com to www.example.com

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC]
  RewriteRule ^(.*)$ http://www.example.com$1 [R=301,L]

In your password protected folder place a .htaccess like this:

AuthType Basic
AuthName "Protected folder /construction/"
AuthUserFile /absolute/path/to/your/public/www/folder/construction/.htpasswd
require valid-user

also place a .htpasswd in there.

A redirect loop only occurs when a requests always matches your redirect condition. Maybe you had a wrong .htaccess in the root folder or there were other rules in there you didn't mention?

Need Your Help

NHibernate: how to select a sorted parent/child and retrieve only specific row_numbers

nhibernate queryover row-number

I have 2 tables: Parent and Child which have the following relation: Parent has many Childs.

Using mercurial's mq for managing local changes

mercurial mercurial-queue

I have a local mercurial repository with some site-specific changes in it. What I would like to do is set a couple files to be un-commitable so that they aren't automatically committed when I do a...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.