ExpressionEngine htaccess具有密码保护的子域

问题描述 投票:0回答:1

我继承了一个ExpressionEngine站点,需要添加一个受密码保护的子域。根目录中的原始htaccess文件是......

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    # Removes index.php from ExpressionEngine URLs
    RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
    RewriteCond %{REQUEST_URI} !/system/.* [NC]
    RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L]

    # Directs all EE web requests through the site index file
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d        
    RewriteRule ^(.*)$ /index.php?/$1 [L]
</IfModule>

...但是当子域中添加了密码保护时,用户可以单击“取消”,然后页面内容将变为可见。

我补充说......

RewriteCond %{HTTP_HOST} !^mysubdomain\. [NC]

...到第二个重写规则,允许密码保护在子域主页上正常工作;但是,该子域中的所有页面或子目录都不起作用。看起来所有页面资源都获得了以下网址:“http://mysubdomain.domain.com/ {site_url} images / uploads / core-images / image.png”

如何在不破坏URL的情况下使密码保护正常工作,以便其他子域页面和子目录正常工作?

.htaccess expressionengine
1个回答
0
投票

经过多次搜索,我们放弃了htaccess路线并使用EE的模板访问限制:https://devot-ee.com/articles/item/using-ee-built-in-http-authentication-for-restricting-development-access

© www.soinside.com 2019 - 2024. All rights reserved.