Norse
Norse

Reputation: 5757

Add 'www.' to URL with htaccess

I've been rewriting my URLs like this:

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

Which works fine, however I have a subdirectory that is password protected via apache/htaccess. When I navigate to this directory, my browser gets a 401 error. Does anyone know how to solve this?

Upvotes: 3

Views: 1708

Answers (1)

Michael Robinson
Michael Robinson

Reputation: 29508

Try putting:

ErrorDocument 401 "Unauthorized Access"
RewriteEngine off

... Authorisation lines

In the .htaccess file containing your authorisation directives.

Upvotes: 3

Related Questions