Password Protect Virtual Directory With .htaccessHow to password protect the domain with htaccess?How to...

Using substitution ciphers to generate new alphabets in a novel

Quasinilpotent , non-compact operators

The IT department bottlenecks progress. How should I handle this?

putting logo on same line but after title, latex

What is going on with 'gets(stdin)' on the site coderbyte?

Does Doodling or Improvising on the Piano Have Any Benefits?

Recommended PCB layout understanding - ADM2572 datasheet

What are the advantages of simplicial model categories over non-simplicial ones?

Why is this estimator biased?

Calculate sum of polynomial roots

How much character growth crosses the line into breaking the character

Strong empirical falsification of quantum mechanics based on vacuum energy density

Can I say "fingers" when referring to toes?

Are Captain Marvel's powers affected by Thanos' actions in Infinity War

Plot of a tornado-shaped surface

What should you do if you miss a job interview (deliberately)?

Why "had" in "[something] we would have made had we used [something]"?

Can disgust be a key component of horror?

Is aluminum electrical wire used on aircraft?

Why does AES have exactly 10 rounds for a 128-bit key, 12 for 192 bits and 14 for a 256-bit key size?

On a tidally locked planet, would time be quantized?

Hero deduces identity of a killer

Creepy dinosaur pc game identification

System.QueryException unexpected token



Password Protect Virtual Directory With .htaccess


How to password protect the domain with htaccess?How to Protect Apache server from this attackHow to exclude a sub-folder from HTaccess RewriteRule.htaccess and .htpassword not workingaccess control by htaccess and 500 Error Page.htaccess password protection not working in localhostHow can I password protect an IIS directory with only FTP access?htaccess rewrite?Difference b/w .htaccess and example.com.confPassword protect folder and allow all subfolders (apache)













2















I have a site with a virtual directory structure like mysite.com/folder/title which is actually a .htaccess rewrite to mysite.com/f/index.php?p=title. I want to password protect the folder folder with .htaccess, and know how to do that with actual folders. But I don't want to password protect the main site mysite.com, and right now if I put the .htaccess file in the mysite.com directory, I am protecting mysite.com and mysite.com/folder. I have also tried protecting mysite.com/f.



How can I protect only mysite.com/folder using .htaccess?



.htaccess contents of mysite.com.



<IfModule mod_rewrite.c>
RewriteEngine On

RewriteRule ^folder/(.*)$ /f/index.php?p=$1 [PT,L,QSA]
RewriteRule ^folder/*$ /f/index.php [L,QSA]

RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

</IfModule>


.htaccess file I tried in mysite.com/f This successfully protects the entire site when moved into the other .htaccess file, so I know the path is correct.



AuthName "Restricted Area" 
AuthType Basic
AuthUserFile /home/myusername/.htpasswd









share|improve this question














bumped to the homepage by Community 17 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
















  • I just plugged your question title into Google and found many articles that answer it far better than I ever could.

    – John Gardeniers
    Sep 8 '10 at 21:47











  • Hi, thanks. I've also done that and read those articles. Unfortunately, none of those answer the question, and the only question that asks the same thing as me is left unanswered. If you have found the answer, could you possibly post the link here?

    – jkeesh
    Sep 13 '10 at 4:57
















2















I have a site with a virtual directory structure like mysite.com/folder/title which is actually a .htaccess rewrite to mysite.com/f/index.php?p=title. I want to password protect the folder folder with .htaccess, and know how to do that with actual folders. But I don't want to password protect the main site mysite.com, and right now if I put the .htaccess file in the mysite.com directory, I am protecting mysite.com and mysite.com/folder. I have also tried protecting mysite.com/f.



How can I protect only mysite.com/folder using .htaccess?



.htaccess contents of mysite.com.



<IfModule mod_rewrite.c>
RewriteEngine On

RewriteRule ^folder/(.*)$ /f/index.php?p=$1 [PT,L,QSA]
RewriteRule ^folder/*$ /f/index.php [L,QSA]

RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

</IfModule>


.htaccess file I tried in mysite.com/f This successfully protects the entire site when moved into the other .htaccess file, so I know the path is correct.



AuthName "Restricted Area" 
AuthType Basic
AuthUserFile /home/myusername/.htpasswd









share|improve this question














bumped to the homepage by Community 17 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
















  • I just plugged your question title into Google and found many articles that answer it far better than I ever could.

    – John Gardeniers
    Sep 8 '10 at 21:47











  • Hi, thanks. I've also done that and read those articles. Unfortunately, none of those answer the question, and the only question that asks the same thing as me is left unanswered. If you have found the answer, could you possibly post the link here?

    – jkeesh
    Sep 13 '10 at 4:57














2












2








2








I have a site with a virtual directory structure like mysite.com/folder/title which is actually a .htaccess rewrite to mysite.com/f/index.php?p=title. I want to password protect the folder folder with .htaccess, and know how to do that with actual folders. But I don't want to password protect the main site mysite.com, and right now if I put the .htaccess file in the mysite.com directory, I am protecting mysite.com and mysite.com/folder. I have also tried protecting mysite.com/f.



How can I protect only mysite.com/folder using .htaccess?



.htaccess contents of mysite.com.



<IfModule mod_rewrite.c>
RewriteEngine On

RewriteRule ^folder/(.*)$ /f/index.php?p=$1 [PT,L,QSA]
RewriteRule ^folder/*$ /f/index.php [L,QSA]

RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

</IfModule>


.htaccess file I tried in mysite.com/f This successfully protects the entire site when moved into the other .htaccess file, so I know the path is correct.



AuthName "Restricted Area" 
AuthType Basic
AuthUserFile /home/myusername/.htpasswd









share|improve this question














I have a site with a virtual directory structure like mysite.com/folder/title which is actually a .htaccess rewrite to mysite.com/f/index.php?p=title. I want to password protect the folder folder with .htaccess, and know how to do that with actual folders. But I don't want to password protect the main site mysite.com, and right now if I put the .htaccess file in the mysite.com directory, I am protecting mysite.com and mysite.com/folder. I have also tried protecting mysite.com/f.



How can I protect only mysite.com/folder using .htaccess?



.htaccess contents of mysite.com.



<IfModule mod_rewrite.c>
RewriteEngine On

RewriteRule ^folder/(.*)$ /f/index.php?p=$1 [PT,L,QSA]
RewriteRule ^folder/*$ /f/index.php [L,QSA]

RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

</IfModule>


.htaccess file I tried in mysite.com/f This successfully protects the entire site when moved into the other .htaccess file, so I know the path is correct.



AuthName "Restricted Area" 
AuthType Basic
AuthUserFile /home/myusername/.htpasswd






.htaccess virtual-directory password-protected






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Sep 8 '10 at 19:42









jkeeshjkeesh

1262




1262





bumped to the homepage by Community 17 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







bumped to the homepage by Community 17 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • I just plugged your question title into Google and found many articles that answer it far better than I ever could.

    – John Gardeniers
    Sep 8 '10 at 21:47











  • Hi, thanks. I've also done that and read those articles. Unfortunately, none of those answer the question, and the only question that asks the same thing as me is left unanswered. If you have found the answer, could you possibly post the link here?

    – jkeesh
    Sep 13 '10 at 4:57



















  • I just plugged your question title into Google and found many articles that answer it far better than I ever could.

    – John Gardeniers
    Sep 8 '10 at 21:47











  • Hi, thanks. I've also done that and read those articles. Unfortunately, none of those answer the question, and the only question that asks the same thing as me is left unanswered. If you have found the answer, could you possibly post the link here?

    – jkeesh
    Sep 13 '10 at 4:57

















I just plugged your question title into Google and found many articles that answer it far better than I ever could.

– John Gardeniers
Sep 8 '10 at 21:47





I just plugged your question title into Google and found many articles that answer it far better than I ever could.

– John Gardeniers
Sep 8 '10 at 21:47













Hi, thanks. I've also done that and read those articles. Unfortunately, none of those answer the question, and the only question that asks the same thing as me is left unanswered. If you have found the answer, could you possibly post the link here?

– jkeesh
Sep 13 '10 at 4:57





Hi, thanks. I've also done that and read those articles. Unfortunately, none of those answer the question, and the only question that asks the same thing as me is left unanswered. If you have found the answer, could you possibly post the link here?

– jkeesh
Sep 13 '10 at 4:57










1 Answer
1






active

oldest

votes


















0














First of all you shouldn't be putting that configuration (the rewrite rules) in .htaccess files, you should be putting it in the main configuration file under a Directory section (assuming you have access to that file). The Apache docs explain why.



You should check that you have the correct AllowOverride settings. If it's all setup correctly, having the .htaccess file you specified sitting in the mysite/f folder should be enough to password protect it.






share|improve this answer
























  • I would but I don't have access to those files. Do you know if there is a workaround just using .htaccess?

    – jkeesh
    Sep 13 '10 at 4:58











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "2"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f179291%2fpassword-protect-virtual-directory-with-htaccess%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














First of all you shouldn't be putting that configuration (the rewrite rules) in .htaccess files, you should be putting it in the main configuration file under a Directory section (assuming you have access to that file). The Apache docs explain why.



You should check that you have the correct AllowOverride settings. If it's all setup correctly, having the .htaccess file you specified sitting in the mysite/f folder should be enough to password protect it.






share|improve this answer
























  • I would but I don't have access to those files. Do you know if there is a workaround just using .htaccess?

    – jkeesh
    Sep 13 '10 at 4:58
















0














First of all you shouldn't be putting that configuration (the rewrite rules) in .htaccess files, you should be putting it in the main configuration file under a Directory section (assuming you have access to that file). The Apache docs explain why.



You should check that you have the correct AllowOverride settings. If it's all setup correctly, having the .htaccess file you specified sitting in the mysite/f folder should be enough to password protect it.






share|improve this answer
























  • I would but I don't have access to those files. Do you know if there is a workaround just using .htaccess?

    – jkeesh
    Sep 13 '10 at 4:58














0












0








0







First of all you shouldn't be putting that configuration (the rewrite rules) in .htaccess files, you should be putting it in the main configuration file under a Directory section (assuming you have access to that file). The Apache docs explain why.



You should check that you have the correct AllowOverride settings. If it's all setup correctly, having the .htaccess file you specified sitting in the mysite/f folder should be enough to password protect it.






share|improve this answer













First of all you shouldn't be putting that configuration (the rewrite rules) in .htaccess files, you should be putting it in the main configuration file under a Directory section (assuming you have access to that file). The Apache docs explain why.



You should check that you have the correct AllowOverride settings. If it's all setup correctly, having the .htaccess file you specified sitting in the mysite/f folder should be enough to password protect it.







share|improve this answer












share|improve this answer



share|improve this answer










answered Sep 10 '10 at 0:46









imoatamaimoatama

32715




32715













  • I would but I don't have access to those files. Do you know if there is a workaround just using .htaccess?

    – jkeesh
    Sep 13 '10 at 4:58



















  • I would but I don't have access to those files. Do you know if there is a workaround just using .htaccess?

    – jkeesh
    Sep 13 '10 at 4:58

















I would but I don't have access to those files. Do you know if there is a workaround just using .htaccess?

– jkeesh
Sep 13 '10 at 4:58





I would but I don't have access to those files. Do you know if there is a workaround just using .htaccess?

– jkeesh
Sep 13 '10 at 4:58


















draft saved

draft discarded




















































Thanks for contributing an answer to Server Fault!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f179291%2fpassword-protect-virtual-directory-with-htaccess%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

As a Security Precaution, the user account has been locked The Next CEO of Stack OverflowMS...

Список ссавців Італії Природоохоронні статуси | Список |...

Українські прізвища Зміст Історичні відомості |...