Mobile app version of vmapp.org
Login or Join
Nimeshi995

: Htaccess redirect to public folder caught in authentication 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

@Nimeshi995

Posted in: #Htaccess

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

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Nimeshi995

1 Comments

Sorted by latest first Latest Oldest Best

 

@Sherry384

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.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme