试图密码保护与htaccess的网址密码保护、网址、htaccess

2023-09-02 20:40:40 作者:°木奉木奉糖べ_

我使用防爆pression引擎2自由职业者的Editon不具有认证模块。

I am using Expression Engine 2 Freelancer editon that doesn't have an authentication module.

我想密码保护,有一个虚拟目录中的模板组的 www.domain.com/template

I am trying to password protect a template group that has a virtual directory www.domain.com/template

我所要做的是使用htaccess的根迫人,当他们尝试并导航到为模板部分,这两个文件在其下输入用户名和密码。

What I am trying to do is use the htaccess in the root to force people to enter a username and password when they try and navigate to the to "template" section and the two files under it.

这前pression发动机的工作模板发送到,而不是物理目录的方式。

The way that Expression Engine works the templates are routed to and not physical directories.

我的问题是我怎么能密码保护这个网址,我试图用LocationMatch,但没有奏效?

My question is how can I password protect this url, I tried using LocationMatch but it didn't work?

感谢

推荐答案

哪种去除方法的index.php 从URL您使用?

Which method of removing index.php from the URL are you using?

如果您使用的是文件和目录检查 方法,你可以修改的Apache 的mod_rewrite 规则,排除某个目录,同时允许所有其他请求被通的index.php 。

If you're using the "File and Directory Check" Method, you can modify the stock Apache mod_rewrite rule to exclude a certain directory while still allowing all other requests to be run thru index.php.

例如,使用基地文件和目录检查重写规则:

For example, using the base "File and Directory Check" rewrite rule:

<IfModule mod_rewrite.c>
    RewriteEngine On 
    RewriteCond $1 !.(gif|jpe?g|png)$ [NC]
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule ^(.*)$ /index.php/$1 [L] 
</IfModule>

通过这种方法,阿帕奇检查,看是否存在文件或目录 - 如果它确实该文件提供给浏览器;如果它不存在,然后将其发送直通的index.php 和解析为的防爆pressionEngine URI 。

With this method, Apache checks to see if the file or directory exists -- if it does the file is served to the browser; if it doesn't exist then it's sent thru index.php and parsed as an ExpressionEngine URI.

要排除的目录中,加入你的.htaccess基本身份验证密码保护的目录:

To exclude your directory, modify the rewrite rule by adding your .htaccess Basic Authenticated password-protected directory:

<IfModule mod_rewrite.c>
    RewriteEngine On 
    RewriteCond %{REQUEST_URI} !^/(secret-directory|secret-directory/.*)$
    RewriteCond $1 !.(gif|jpe?g|png)$ [NC]
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule ^(.*)$ /index.php/$1 [L] 
</IfModule>

我不完全知道什么所有的限制都与自由职业者许可的,但我answered关于防爆pressionEngine 密码保护网页,可能被证明有助于您的情况类似的问题。

I'm not fully aware of what all the limitations are with the Freelancer License, but I answered a similar question about password-protecting pages in ExpressionEnginethat may prove helpful in your situation.

 
精彩推荐
图片推荐