Apache authentication inside a WordPress installWebDAV on CentOS - getting 403 error when attempt to uploadHow to Protect Apache server from this attack.htaccess directory nightmareApache mod_setenvif Server_Addr.htaccess password protection not working in localhostApache authentication requirement based on locationDoes Amazon Elastic Beanstalk cope with HTTP Authentication?Mod_rewite - do these rewrite rules work?Difference b/w .htaccess and example.com.confPHP scripts fail after adding .htaccess to password protect a dir

Where did the “vikings wear helmets with horn” stereotype come from and why?

What are the problems in teaching guitar via Skype?

What is the probability of having a pair of doubles when throwing dice?

Infinitely many hats

Turn on QGIS Dark Mode

What is the difference between nullifying your vote and not going to vote at all?

Can a helicopter mask itself from Radar?

What caused the tendency for conservatives to not support climate change regulations?

If a massive object like Jupiter flew past the Earth how close would it need to come to pull people off of the surface?

Is having a hidden directory under /etc safe?

What is the indigenous Russian word for a wild boar?

How to prevent bad sectors?

Can an old DSLR be upgraded to match modern smartphone image quality

Adding strings in lists together

Mother abusing my finances

How old was this woman (from Tomb of Annihilation) at her death?

Uncommanded roll at high speed

If a problem only occurs randomly once in every N times on average, how many tests do I have to perform to be certain that it's now fixed?

Modern approach to radio buttons

What are the slash markings on Gatwick's 08R/26L?

Socratic Paradox

Differences between “pas vrai ?”, “c’est ça ?”, “hein ?”, and “n’est-ce pas ?”

chmod would set file permission to 000 no matter what permission i try to set

The deliberate use of misleading terminology



Apache authentication inside a WordPress install


WebDAV on CentOS - getting 403 error when attempt to uploadHow to Protect Apache server from this attack.htaccess directory nightmareApache mod_setenvif Server_Addr.htaccess password protection not working in localhostApache authentication requirement based on locationDoes Amazon Elastic Beanstalk cope with HTTP Authentication?Mod_rewite - do these rewrite rules work?Difference b/w .htaccess and example.com.confPHP scripts fail after adding .htaccess to password protect a dir






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I am currently running into an issue with trying to password protect a directory that is sitting inside a directory that's running WordPress. This is for a directory called "admin" that handles a few things outside of WP.



In my WordPress .htaccess file, I have set a rule to ignore this directory.



RewriteEngine On
RewriteBase /
RewriteRule ^(admin|index.php)$ - [L]
RewriteCond %REQUEST_FILENAME !-f
RewriteCond %REQUEST_FILENAME !-d
RewriteRule . /index.php [L]


When I go to my admin directory, it works just fine and I'm able to see what I should be seeing (basic PHP stuff).



However, when I try and password protect that directory by putting an .htaccess and .htpassword file in there, I get a WordPress 404 error. This is what it looks like:



AuthUserFile /home/myuser/public_html/admin/.htpasswd
AuthName "Password Protected Area"
AuthType Basic

<limit GET POST>
require valid-user
</limit>


It (obviously) has something to do with the "require valid-user" line. This particular .htaccess/.htpasswd file worked just fine on a similar server set up.



Any thoughts?










share|improve this question






















  • A 401 error, as opposed to a 404, is what you would expect to see if the require valid-user line were breaking things. Anything helpful in the Apache error log?

    – Shane Madden
    Apr 4 '11 at 18:20











  • It specifically says 404, not 401 (but I that's coming from WordPress). And no, I don't see anything in the error log.

    – Charles Chadwick
    Apr 4 '11 at 20:23

















0















I am currently running into an issue with trying to password protect a directory that is sitting inside a directory that's running WordPress. This is for a directory called "admin" that handles a few things outside of WP.



In my WordPress .htaccess file, I have set a rule to ignore this directory.



RewriteEngine On
RewriteBase /
RewriteRule ^(admin|index.php)$ - [L]
RewriteCond %REQUEST_FILENAME !-f
RewriteCond %REQUEST_FILENAME !-d
RewriteRule . /index.php [L]


When I go to my admin directory, it works just fine and I'm able to see what I should be seeing (basic PHP stuff).



However, when I try and password protect that directory by putting an .htaccess and .htpassword file in there, I get a WordPress 404 error. This is what it looks like:



AuthUserFile /home/myuser/public_html/admin/.htpasswd
AuthName "Password Protected Area"
AuthType Basic

<limit GET POST>
require valid-user
</limit>


It (obviously) has something to do with the "require valid-user" line. This particular .htaccess/.htpasswd file worked just fine on a similar server set up.



Any thoughts?










share|improve this question






















  • A 401 error, as opposed to a 404, is what you would expect to see if the require valid-user line were breaking things. Anything helpful in the Apache error log?

    – Shane Madden
    Apr 4 '11 at 18:20











  • It specifically says 404, not 401 (but I that's coming from WordPress). And no, I don't see anything in the error log.

    – Charles Chadwick
    Apr 4 '11 at 20:23













0












0








0








I am currently running into an issue with trying to password protect a directory that is sitting inside a directory that's running WordPress. This is for a directory called "admin" that handles a few things outside of WP.



In my WordPress .htaccess file, I have set a rule to ignore this directory.



RewriteEngine On
RewriteBase /
RewriteRule ^(admin|index.php)$ - [L]
RewriteCond %REQUEST_FILENAME !-f
RewriteCond %REQUEST_FILENAME !-d
RewriteRule . /index.php [L]


When I go to my admin directory, it works just fine and I'm able to see what I should be seeing (basic PHP stuff).



However, when I try and password protect that directory by putting an .htaccess and .htpassword file in there, I get a WordPress 404 error. This is what it looks like:



AuthUserFile /home/myuser/public_html/admin/.htpasswd
AuthName "Password Protected Area"
AuthType Basic

<limit GET POST>
require valid-user
</limit>


It (obviously) has something to do with the "require valid-user" line. This particular .htaccess/.htpasswd file worked just fine on a similar server set up.



Any thoughts?










share|improve this question














I am currently running into an issue with trying to password protect a directory that is sitting inside a directory that's running WordPress. This is for a directory called "admin" that handles a few things outside of WP.



In my WordPress .htaccess file, I have set a rule to ignore this directory.



RewriteEngine On
RewriteBase /
RewriteRule ^(admin|index.php)$ - [L]
RewriteCond %REQUEST_FILENAME !-f
RewriteCond %REQUEST_FILENAME !-d
RewriteRule . /index.php [L]


When I go to my admin directory, it works just fine and I'm able to see what I should be seeing (basic PHP stuff).



However, when I try and password protect that directory by putting an .htaccess and .htpassword file in there, I get a WordPress 404 error. This is what it looks like:



AuthUserFile /home/myuser/public_html/admin/.htpasswd
AuthName "Password Protected Area"
AuthType Basic

<limit GET POST>
require valid-user
</limit>


It (obviously) has something to do with the "require valid-user" line. This particular .htaccess/.htpasswd file worked just fine on a similar server set up.



Any thoughts?







apache-2.2 .htaccess wordpress password-protected .htpasswd






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Apr 4 '11 at 18:03









Charles ChadwickCharles Chadwick

2816




2816












  • A 401 error, as opposed to a 404, is what you would expect to see if the require valid-user line were breaking things. Anything helpful in the Apache error log?

    – Shane Madden
    Apr 4 '11 at 18:20











  • It specifically says 404, not 401 (but I that's coming from WordPress). And no, I don't see anything in the error log.

    – Charles Chadwick
    Apr 4 '11 at 20:23

















  • A 401 error, as opposed to a 404, is what you would expect to see if the require valid-user line were breaking things. Anything helpful in the Apache error log?

    – Shane Madden
    Apr 4 '11 at 18:20











  • It specifically says 404, not 401 (but I that's coming from WordPress). And no, I don't see anything in the error log.

    – Charles Chadwick
    Apr 4 '11 at 20:23
















A 401 error, as opposed to a 404, is what you would expect to see if the require valid-user line were breaking things. Anything helpful in the Apache error log?

– Shane Madden
Apr 4 '11 at 18:20





A 401 error, as opposed to a 404, is what you would expect to see if the require valid-user line were breaking things. Anything helpful in the Apache error log?

– Shane Madden
Apr 4 '11 at 18:20













It specifically says 404, not 401 (but I that's coming from WordPress). And no, I don't see anything in the error log.

– Charles Chadwick
Apr 4 '11 at 20:23





It specifically says 404, not 401 (but I that's coming from WordPress). And no, I don't see anything in the error log.

– Charles Chadwick
Apr 4 '11 at 20:23










1 Answer
1






active

oldest

votes


















0














Try closing your browser and then trying to connect. You may have cached credentials that are being used.



If you have multiple secured directories with different passwords, use different values for the Authname.



EDIT: Try moving the Require outside the Limit statement. I always group the Auth definitions with the Require statement in the same block.



Your error seems to indicate the requested resource does not exist or is not readable. Try removing your rewrite modifications for admin. The standard rewrite rules work well with directories and files mixed into the Wordpress installation.



You may want to use a LimitExcept block instead of a Limit block to prevent access other than GET or POST. This is my working .htaccess file.



AuthType Basic
AuthName "Restricted Access"
AuthUserFile /etc/wordpress/htpasswd
Require Valid-User
<LimitExcept GET POST>
Order allow,deny
Deny from all
</LimitExcept>


Make sure the .ht* files are readable by the web server. I test unauthorized access by changing the user id in the htpasswd file to one I haven't used.






share|improve this answer

























  • Thanks for the response. I did try closing the browser, but no dice. I'm not even being promoted for a user or password. Also, there is only one directly secured via .htaccess.

    – Charles Chadwick
    Apr 5 '11 at 18:14











  • I tried your suggestions, but still no dice. I'm thinking about try to move the admin directory outside of the web root and then just setting up a subdomain.

    – Charles Chadwick
    Apr 6 '11 at 16:39











  • @Charles: You can point a subdomain directly at the admin directory. Have you tried without the .htaccess file. If it doesn't work without the .htaccess file then it won't work with one. On Ubuntu the WordPress software is in /usr/share, but symlinked to /var/www for the web server to access it.

    – BillThor
    Apr 6 '11 at 21:42











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%2f255565%2fapache-authentication-inside-a-wordpress-install%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














Try closing your browser and then trying to connect. You may have cached credentials that are being used.



If you have multiple secured directories with different passwords, use different values for the Authname.



EDIT: Try moving the Require outside the Limit statement. I always group the Auth definitions with the Require statement in the same block.



Your error seems to indicate the requested resource does not exist or is not readable. Try removing your rewrite modifications for admin. The standard rewrite rules work well with directories and files mixed into the Wordpress installation.



You may want to use a LimitExcept block instead of a Limit block to prevent access other than GET or POST. This is my working .htaccess file.



AuthType Basic
AuthName "Restricted Access"
AuthUserFile /etc/wordpress/htpasswd
Require Valid-User
<LimitExcept GET POST>
Order allow,deny
Deny from all
</LimitExcept>


Make sure the .ht* files are readable by the web server. I test unauthorized access by changing the user id in the htpasswd file to one I haven't used.






share|improve this answer

























  • Thanks for the response. I did try closing the browser, but no dice. I'm not even being promoted for a user or password. Also, there is only one directly secured via .htaccess.

    – Charles Chadwick
    Apr 5 '11 at 18:14











  • I tried your suggestions, but still no dice. I'm thinking about try to move the admin directory outside of the web root and then just setting up a subdomain.

    – Charles Chadwick
    Apr 6 '11 at 16:39











  • @Charles: You can point a subdomain directly at the admin directory. Have you tried without the .htaccess file. If it doesn't work without the .htaccess file then it won't work with one. On Ubuntu the WordPress software is in /usr/share, but symlinked to /var/www for the web server to access it.

    – BillThor
    Apr 6 '11 at 21:42















0














Try closing your browser and then trying to connect. You may have cached credentials that are being used.



If you have multiple secured directories with different passwords, use different values for the Authname.



EDIT: Try moving the Require outside the Limit statement. I always group the Auth definitions with the Require statement in the same block.



Your error seems to indicate the requested resource does not exist or is not readable. Try removing your rewrite modifications for admin. The standard rewrite rules work well with directories and files mixed into the Wordpress installation.



You may want to use a LimitExcept block instead of a Limit block to prevent access other than GET or POST. This is my working .htaccess file.



AuthType Basic
AuthName "Restricted Access"
AuthUserFile /etc/wordpress/htpasswd
Require Valid-User
<LimitExcept GET POST>
Order allow,deny
Deny from all
</LimitExcept>


Make sure the .ht* files are readable by the web server. I test unauthorized access by changing the user id in the htpasswd file to one I haven't used.






share|improve this answer

























  • Thanks for the response. I did try closing the browser, but no dice. I'm not even being promoted for a user or password. Also, there is only one directly secured via .htaccess.

    – Charles Chadwick
    Apr 5 '11 at 18:14











  • I tried your suggestions, but still no dice. I'm thinking about try to move the admin directory outside of the web root and then just setting up a subdomain.

    – Charles Chadwick
    Apr 6 '11 at 16:39











  • @Charles: You can point a subdomain directly at the admin directory. Have you tried without the .htaccess file. If it doesn't work without the .htaccess file then it won't work with one. On Ubuntu the WordPress software is in /usr/share, but symlinked to /var/www for the web server to access it.

    – BillThor
    Apr 6 '11 at 21:42













0












0








0







Try closing your browser and then trying to connect. You may have cached credentials that are being used.



If you have multiple secured directories with different passwords, use different values for the Authname.



EDIT: Try moving the Require outside the Limit statement. I always group the Auth definitions with the Require statement in the same block.



Your error seems to indicate the requested resource does not exist or is not readable. Try removing your rewrite modifications for admin. The standard rewrite rules work well with directories and files mixed into the Wordpress installation.



You may want to use a LimitExcept block instead of a Limit block to prevent access other than GET or POST. This is my working .htaccess file.



AuthType Basic
AuthName "Restricted Access"
AuthUserFile /etc/wordpress/htpasswd
Require Valid-User
<LimitExcept GET POST>
Order allow,deny
Deny from all
</LimitExcept>


Make sure the .ht* files are readable by the web server. I test unauthorized access by changing the user id in the htpasswd file to one I haven't used.






share|improve this answer















Try closing your browser and then trying to connect. You may have cached credentials that are being used.



If you have multiple secured directories with different passwords, use different values for the Authname.



EDIT: Try moving the Require outside the Limit statement. I always group the Auth definitions with the Require statement in the same block.



Your error seems to indicate the requested resource does not exist or is not readable. Try removing your rewrite modifications for admin. The standard rewrite rules work well with directories and files mixed into the Wordpress installation.



You may want to use a LimitExcept block instead of a Limit block to prevent access other than GET or POST. This is my working .htaccess file.



AuthType Basic
AuthName "Restricted Access"
AuthUserFile /etc/wordpress/htpasswd
Require Valid-User
<LimitExcept GET POST>
Order allow,deny
Deny from all
</LimitExcept>


Make sure the .ht* files are readable by the web server. I test unauthorized access by changing the user id in the htpasswd file to one I haven't used.







share|improve this answer














share|improve this answer



share|improve this answer








edited Apr 5 '11 at 21:15

























answered Apr 4 '11 at 23:14









BillThor BillThor

24.9k22662




24.9k22662












  • Thanks for the response. I did try closing the browser, but no dice. I'm not even being promoted for a user or password. Also, there is only one directly secured via .htaccess.

    – Charles Chadwick
    Apr 5 '11 at 18:14











  • I tried your suggestions, but still no dice. I'm thinking about try to move the admin directory outside of the web root and then just setting up a subdomain.

    – Charles Chadwick
    Apr 6 '11 at 16:39











  • @Charles: You can point a subdomain directly at the admin directory. Have you tried without the .htaccess file. If it doesn't work without the .htaccess file then it won't work with one. On Ubuntu the WordPress software is in /usr/share, but symlinked to /var/www for the web server to access it.

    – BillThor
    Apr 6 '11 at 21:42

















  • Thanks for the response. I did try closing the browser, but no dice. I'm not even being promoted for a user or password. Also, there is only one directly secured via .htaccess.

    – Charles Chadwick
    Apr 5 '11 at 18:14











  • I tried your suggestions, but still no dice. I'm thinking about try to move the admin directory outside of the web root and then just setting up a subdomain.

    – Charles Chadwick
    Apr 6 '11 at 16:39











  • @Charles: You can point a subdomain directly at the admin directory. Have you tried without the .htaccess file. If it doesn't work without the .htaccess file then it won't work with one. On Ubuntu the WordPress software is in /usr/share, but symlinked to /var/www for the web server to access it.

    – BillThor
    Apr 6 '11 at 21:42
















Thanks for the response. I did try closing the browser, but no dice. I'm not even being promoted for a user or password. Also, there is only one directly secured via .htaccess.

– Charles Chadwick
Apr 5 '11 at 18:14





Thanks for the response. I did try closing the browser, but no dice. I'm not even being promoted for a user or password. Also, there is only one directly secured via .htaccess.

– Charles Chadwick
Apr 5 '11 at 18:14













I tried your suggestions, but still no dice. I'm thinking about try to move the admin directory outside of the web root and then just setting up a subdomain.

– Charles Chadwick
Apr 6 '11 at 16:39





I tried your suggestions, but still no dice. I'm thinking about try to move the admin directory outside of the web root and then just setting up a subdomain.

– Charles Chadwick
Apr 6 '11 at 16:39













@Charles: You can point a subdomain directly at the admin directory. Have you tried without the .htaccess file. If it doesn't work without the .htaccess file then it won't work with one. On Ubuntu the WordPress software is in /usr/share, but symlinked to /var/www for the web server to access it.

– BillThor
Apr 6 '11 at 21:42





@Charles: You can point a subdomain directly at the admin directory. Have you tried without the .htaccess file. If it doesn't work without the .htaccess file then it won't work with one. On Ubuntu the WordPress software is in /usr/share, but symlinked to /var/www for the web server to access it.

– BillThor
Apr 6 '11 at 21:42

















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%2f255565%2fapache-authentication-inside-a-wordpress-install%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

Wikipedia:Vital articles Мазмуну Biography - Өмүр баян Philosophy and psychology - Философия жана психология Religion - Дин Social sciences - Коомдук илимдер Language and literature - Тил жана адабият Science - Илим Technology - Технология Arts and recreation - Искусство жана эс алуу History and geography - Тарых жана география Навигация менюсу

Bruxelas-Capital Índice Historia | Composición | Situación lingüística | Clima | Cidades irmandadas | Notas | Véxase tamén | Menú de navegacióneO uso das linguas en Bruxelas e a situación do neerlandés"Rexión de Bruxelas Capital"o orixinalSitio da rexiónPáxina de Bruselas no sitio da Oficina de Promoción Turística de Valonia e BruxelasMapa Interactivo da Rexión de Bruxelas-CapitaleeWorldCat332144929079854441105155190212ID28008674080552-90000 0001 0666 3698n94104302ID540940339365017018237

What should I write in an apology letter, since I have decided not to join a company after accepting an offer letterShould I keep looking after accepting a job offer?What should I do when I've been verbally told I would get an offer letter, but still haven't gotten one after 4 weeks?Do I accept an offer from a company that I am not likely to join?New job hasn't confirmed starting date and I want to give current employer as much notice as possibleHow should I address my manager in my resignation letter?HR delayed background verification, now jobless as resignedNo email communication after accepting a formal written offer. How should I phrase the call?What should I do if after receiving a verbal offer letter I am informed that my written job offer is put on hold due to some internal issues?Should I inform the current employer that I am about to resign within 1-2 weeks since I have signed the offer letter and waiting for visa?What company will do, if I send their offer letter to another company