15 years on The Web
miniBB ® miniBB®
miniBB Support Forums
 | Forums | Register | Reply | Search | Statistics | Manual |
Specific miniBB Support Forums / Specific /   

Protected directory with htaccess

Author Jaime
#1 | Posted: 2 Oct 2013 12:33 
Something else;-) A directory should be protected. Has access to only one user at a particular IP AND having to log in addition to username and password.

If no problem :)

But everyone already comes with a non-matching IP ... should not even be prompted to enter username and password! He should simply forwarded to another page.

Since i am currently on the tube and do not get out that with .htaccess

My attempt was:

RewriteCond %{REMOTE_HOST} !^xxx\.xxx\.xxx\.xxx
RewriteRule ^(.*)$ myurl/? [R=301,L]

AuthType Basic

Was it not so that rewriting is performed before authorization?

So I'm looking for this solution and .. Is that even possible via htaccess?

Incorrect IP - redirect
Correct IP - allow AND check authorization

Author Paul
Lead Developer
#2 | Posted: 2 Oct 2013 13:56 | Edited by: Paul 
How this could be related to miniBB?

Author Jaime
#3 | Posted: 2 Oct 2013 14:24 
No Paul, has nothing to do with miniBB.

Author Paul
Lead Developer
#4 | Posted: 2 Oct 2013 20:45 
Then may be it would be useful to ask .htaccess-related questions on the Apache-related forum :-) Because it truly depends on many factors, how to do this, it also depends on your customization of server settings. Even pre-existing codes may work differently on various servers, I can't even suggest something theoretical, it should be developed on your server only. No aside advice is possible, I guess.

Author Jaime
#5 | Posted: 4 Oct 2013 10:44 
Sure there would be also a good place to ask ... but there is certainly one or the other of possibly had a tip for me :)

And the solution i've probably found yourself, i just need enclose the authorization with a <FilesMatch "."> block, also

RewriteCond ...

<FilesMatch ".">
AuthType Basic

Now it works (by me!) , Incorrect IP - redirect and no display of the authorization area, Correct IP - allow AND display/check the authorization area. My question has been resolved and my curiosity has been satisfied with it :)

Specific miniBB Support Forums / Specific / Protected directory with htaccess Top

Your Reply Click this icon to move up to the quoted message

 Short link for this topic:

You are welcome to post anonymously, by entering a nickname with no password (if the similar Username has not been taken yet), or by leaving both fields empty. If you have a forums account, you can also sign in from this page without posting a message, or sign in and post at once.

Before posting, make sure your message is compliant with our forum posting rules. If not, it may be locked or deleted with no explanation.
miniBB Support Forums Powered by Forum Software miniBB ® Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contacts
Try the Captcha add-on: protect your miniBB-forums from the automated spam and flood.
Captcha Addon for miniBB