简体   繁体   English

允许 Apache 配置使用 wordpress 登录来保护 linux 服务器上的私有目录

[英]Allow Apache config to use wordpress login to protect private directory on linux server

I have a private directory and WordPress directory on the server, is there a way to protect this private directory using the WordPress login page?我在服务器上有一个私有目录和 WordPress 目录,有没有办法使用 WordPress 登录页面来保护这个私有目录? I will share the links of the private files to the WordPress users, but I don't want them to be able to download anything from this folder until they log in, so I protect the content of this folder.我会将私人文件的链接分享给 WordPress 用户,但我不希望他们在登录之前能够从该文件夹下载任何内容,因此我保护了该文件夹的内容。

I looked into mod_dbd , I tried to connect to WordPress MySQL installation, but I was getting this error Invalid command 'DBDriver', perhaps misspelled or defined by a module not included in the server configuration I don't know if I am going in the right direction or no.我查看了mod_dbd ,我试图连接到 WordPress MySQL 安装,但我收到此错误Invalid command 'DBDriver', perhaps misspelled or defined by a module not included in the server configuration我不知道我是否要去方向是否正确。

Can someone plz guide me?有人可以指导我吗?

The method I follow was having a folder inside wordpress that has symlink to the outside folder, and protect this file through htaccess to require authentication.我遵循的方法是在 wordpress 中有一个文件夹,该文件夹具有指向外部文件夹的符号链接,并通过 htaccess 保护此文件以要求身份验证。

<IfModule mod_rewrite.c>
 RewriteEngine On
 RewriteBase /
 RewriteCond %{HTTP_COOKIE} !.*wordpress_logged_in.*$ [NC]
 RewriteCond %{REQUEST_URI} folder_u_want_to_protect/.* [NC]
 RewriteRule . http://%{HTTP_HOST}%1/wp-login.php?redirect_to=%{REQUEST_URI} [L,QSA]

</IfModule>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM