Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/visual-studio-code/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.htaccess 银条纹&。htaccess-如何访问特定文件夹并查看目录索引?_.htaccess_Silverstripe - Fatal编程技术网

.htaccess 银条纹&。htaccess-如何访问特定文件夹并查看目录索引?

.htaccess 银条纹&。htaccess-如何访问特定文件夹并查看目录索引?,.htaccess,silverstripe,.htaccess,Silverstripe,当我点击URI/client files时,我希望能够访问目录索引视图-我使用的是Silverstripe,它自带了自己的。htaccess,我在最后提供了它 e、 gdomain.com/client文件 我尝试实现的示例图像,只是使用不同的文件夹名称 我尝试了以下方法: 我尝试添加-(这给了我500个错误): 最后,我用@munomono说的话让它发挥作用,但略有不同 我最终在/client files目录中拥有了自己的.htaccess文件,并将其放入其中: .htaccess Rewr

当我点击URI
/client files
时,我希望能够访问目录索引视图-我使用的是Silverstripe,它自带了自己的
。htaccess
,我在最后提供了它

e、 g
domain.com/client文件

我尝试实现的示例图像,只是使用不同的文件夹名称

我尝试了以下方法:

我尝试添加-(这给了我500个错误):


最后,我用@munomono说的话让它发挥作用,但略有不同

我最终在
/client files
目录中拥有了自己的.htaccess文件,并将其放入其中:

.htaccess

RewriteCond %{REQUEST_FILENAME} !-d
Options +Indexes

在/client文件中拥有自己的.htaccess怎么样?把RewritesEngine设置为off,索引设置为on?Yep这似乎很有效,很高兴看到您解决了问题。请您将您的答案标记为已接受的答案,以便其他人知道此问题已解决?谢谢
### SILVERSTRIPE START ###
# Deny access to templates (but allow from localhost)
<Files *.ss>
    Order deny,allow
    Deny from all
    Allow from 127.0.0.1
</Files>

# Deny access to IIS configuration
<Files web.config>
    Order deny,allow
    Deny from all
</Files>

# Deny access to YAML configuration files which might include sensitive information
<Files *.yml>
    Order allow,deny
    Deny from all
</Files>

# Route errors to static pages automatically generated by SilverStripe
ErrorDocument 404 /assets/error-404.html
ErrorDocument 500 /assets/error-500.html

<IfModule mod_rewrite.c>

    # Turn off index.php handling requests to the homepage fixes issue in apache >=2.4
    <IfModule mod_dir.c>
        DirectoryIndex disabled
    </IfModule>

    SetEnv HTTP_MOD_REWRITE On
    RewriteEngine On
    RewriteBase '/'


    # Deny access to potentially sensitive files and folders
    RewriteRule ^vendor(/|$) - [F,L,NC]
    RewriteRule silverstripe-cache(/|$) - [F,L,NC]
    RewriteRule composer\.(json|lock) - [F,L,NC]

    # Process through SilverStripe if no file with the requested name exists.
    # Pass through the original path as a query parameter, and retain the existing parameters.
    RewriteCond %{REQUEST_URI} ^(.*)$
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule .* framework/main.php?url=%1 [QSA]
</IfModule>

### SILVERSTRIPE END ###
RewriteCond %{REQUEST_FILENAME} !-d
Options +Indexes