htaccess忽略Codeigniter应用程序中的第三方库

时间:2018-03-09 07:11:05

标签: php .htaccess codeigniter

我想通过直接网址访问我的Codeigniter应用程序中的third_party文件夹中包含的index.php文件,例如www.website.com/app/external/www

我的申请结构是这样的:

application/
   library/
   third_party/
      external/
         www/

我试过了

RewriteRule ^app/external/www /app/application/third_party/external/www/$1 [L]

但它不起作用。

以下是完整的htaccess文件,以防其他任何因素影响它。

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^(.*)$ /index.php?/$1 [L,QSA]
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Options -Indexes
RewriteEngine on 
RewriteCond %{HTTP_REFERER} !^https://(www\.)?website.com [NC] 
RewriteCond %{HTTP_REFERER} !^https://(www\.)?website.com.*$ [NC] 
RewriteRule \.(pdf)$ - [F]

希望有人能看到我所缺少的东西

更新:

这是与应用程序目录

处于同一级别的htaccess文件
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    #THIS LINE ALLOWS BASIC AUTH FOR REST DO NOT DELETE#
    RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization}]
    # Removes index.php from ExpressionEngine URLs
    RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
    RewriteCond %{REQUEST_URI} !/system/.* [NC]
    RewriteRule (.*?)index\.php/*(.*) app/$1$2 [R=301,NE,L]

    # Directs all EE web requests through the site index file
    RewriteCond %{REQUEST_URI} !^/php-fpm/*
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI}  !(third_party) [NC]
    RewriteRule ^(.*)$ app/index.php/$1 [L]
    RewriteRule \.(pdf)$ - [F]

</IfModule>

更新2:这是控制目录可见性的htaccess文件。如何从url重写中排除third_party文件夹?到目前为止,这种方法不起作用

0 个答案:

没有答案