Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 374
Norse Avatar asked Feb 01 '26 15:02

Norse


1 Answers

Try putting:

ErrorDocument 401 "Unauthorized Access"
RewriteEngine off

... Authorisation lines

In the .htaccess file containing your authorisation directives.

like image 189
Michael Robinson Avatar answered Feb 04 '26 07:02

Michael Robinson