【问题标题】:ExpressionEngine htaccess with password protected subdomain带有密码保护子域的 ExpressionEngine htaccess
【发布时间】:2019-03-12 15:43:56
【问题描述】:

我继承了一个 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]

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

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

【问题讨论】:

    标签: .htaccess expressionengine


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-10-14
      • 1970-01-01
      • 2012-05-11
      • 1970-01-01
      • 2016-01-26
      相关资源
      最近更新 更多