理解这个生成的.htaccess 文件并解决我的问题_

理解这个生成的.htaccess 文件并解决我的问题_

我在 Web 服务器上下载并安装了一些软件,它似乎在我的根文件夹中生成了一个 .htaccess 文件。起初我并不在意,直到我意识到我无法导航到其他目录中的某些页面。

我认为它一定是 .htaccess 的东西,所以我在根文件夹中找到了它,它在这里:

<IfModule mod_rewrite.c>
    SetEnv HTTP_F_URL On
    RewriteEngine on
    # You may need to set the RewriteBase to point to the root of your
    # Fruml installation if you get HTTP 500 errors.
    # RewriteBase /dev
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php?cmd=$1 [QSA,L]
</IfModule>

<IfModule mod_expires.c>
    SetEnv HTTP_EXPIRES On
    ExpiresActive On
    ExpiresByType image/gif A5184000
    ExpiresByType image/png A5184000
    ExpiresByType image/jpeg A5184000
    ExpiresByType application/x-javascript A5184000
    ExpiresByType application/javascript A5184000
    ExpiresByType text/css A5184000
</IfModule>

<IfModule mod_deflate.c>
    # Insert filter
    SetOutputFilter DEFLATE

    # Netscape 4.x has some problems...
    BrowserMatch ozilla/4 gzip-only-text/html

    # Netscape 4.06-4.08 have some more problems
    BrowserMatch ozilla/4\.0[678] no-gzip

    # MSIE masquerades as Netscape, but it is fine
    # BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

    # NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
    # the above regex won't work. You can use the following
    # workaround to get the desired effect:
    BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html

    # Don't compress images
    SetEnvIfNoCase Request_URI \
    \.(?:gif|jpe?g|png)$ no-gzip dont-vary

    # Make sure proxies don't deliver the wrong content
    Header append Vary User-Agent env=!dont-vary
</IfModule>

我想要获取的文件:

[institutum /home/public]$ ls
Fruml+0.0.14            db                      forum_backup.tar        img
LICENSE.txt             forum                   fruml                   index.php
[institutum /home/public]$ cd db      
[institutum /home/public/db]$ ls
admin   bio     chm     eng     mat     phy
[institutum /home/public/db]$ cd admin
[institutum /home/public/db/admin]$ ls
xoda-0.3.1              xoda-0.3.1.tar.bz2
[institutum /home/public/db/admin]$ cd xoda-0.3.1
[institutum /home/public/db/admin/xoda-0.3.1]$ ls
README                  functions.php           js                      xd_icons
config.sample.php       index.php               style.css               zipstream.php
[institutum /home/public/db/admin/xoda-0.3.1]$ 

xoda 文件夹中的 index.php。

重命名根文件夹中的 .htaccess 会导致其他链接失败。

我在我的 db 文件夹中发现了另一个 .htaccess 文件:

php_flag allow_call_time_pass_reference Off
php_value error_reporting 2047
php_flag magic_quotes_gpc Off
php_flag register_globals Off
php_flag short_open_tag Off
php_flag zend.ze1_compatibility_mode On

答案1

尝试RewriteRule ^(db/admin/xoda-0.3.1) - [L]在其他 RewriteRule 指令之前添加到 mod_rewite 部分:

<IfModule mod_rewrite.c>
    SetEnv HTTP_F_URL On
    RewriteEngine on
    # You may need to set the RewriteBase to point to the root of your
    # Fruml installation if you get HTTP 500 errors.
    # RewriteBase /dev
    RewriteRule ^(db/admin/xoda-0.3.1) - [L]
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php?cmd=$1 [QSA,L]
</IfModule>

相关内容