1

I have an .htaccess file at the root of my server which has auth on it. I have a redirect statement that upon entering example.myserver.com instead of myserver.com redirects the user to a sub folder with Satisfy any in the .htaccess, BUT when using example.myserver.com the auth seems to kick in before the redirect happens, is there a way to let it see that the folder to redirect to is public?

Options -MultiViews +FollowSymLinks
RewriteEngine On 
RewriteCond %{HTTP_HOST} ^example.server.com$
RewriteRule ^(/)?$ subfolder [L]



AuthUserFile /var/.htpasswd
#AuthGroupFile /dev/null
AuthName Welcome
AuthType Basic

require user someone

IndexOptions +ShowForbidden
ErrorDocument 401 /error401.html
ErrorDocument 404 /errorGeneric.html
ErrorDocument 500 /errorGeneric.html

and the .htaccess of the subfolder just has Satisfy any in it

2
  • Show the contents of your htacess file
    – John Conde
    Commented Apr 24, 2014 at 13:23
  • added htaccess text
    – user38100
    Commented Apr 24, 2014 at 14:29

1 Answer 1

1

It is not wise to require authentication on your home page aka site root unless you do not want your site seen at all. You have to give people a place to land. Generally, a portion of any site would not require authentication. This gives you and your potential user the opportunity to know about your site, offerings, products, prices, access to contact and about, etc. Then the protected content would be in a sub-folder or a sub-domain.

Having placed authentication on your root takes priority over other processing. When you think of Apache there is a request process priority order. Authentication is a high priority function that I am sure trumps processing any .htaccess file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.