htaccess 隐藏扩展不允许表达式引擎登录



说了很多,但是,在我的.htaccess 中使用这个

    Options +FollowSymLinks -MultiViews
    # Turn mod_rewrite on
    RewriteEngine On
    RewriteBase /
    ## removes index.php
    # Add/Hide index.php from everything except admin
    RewriteCond $1 !.(gif|jpe?g|png)$ [NC]
    RewriteCond $1 !admin$ [NC]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /index.php?$1 [L]
    ## hide .php extension
    # To externally redirect foo.php to foo
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,}s([^.]+).php [NC]
    RewriteRule ^ %1 [R,L,NC]
    ## To internally redirect /dir/foo to /dir/foo.php
    RewriteCond %{REQUEST_FILENAME}.php -f
    RewriteRule ^ %{REQUEST_URI}.php [L]

将允许我使用/admin作为url,但不允许我登录,

如果我删除这行RewriteCond $1 !admin$ [NC],它会将index.php预处理到/admin使其成为index.php/admin和我看不到页面

您想要实现什么?只是删除index.php?如果是这样的话,.htaccess有效:

重写引擎打开重写结束%{REQUEST_FILENAME}-f重写结束%{REQUEST_FILENAME}-d重写规则^(.*)$/index.php/$1[L]

然后你必须访问/admin.php,或者如果你愿意,你可以把它放在一个名为/admin的目录中。

最新更新