允许使用.htaccess访问子文件夹中的索引文件


Allow access to index file in subfolder using .htaccess

我目前在.htaccess文件中有以下代码,它正按照我希望的方式工作。

但是,我希望能够访问mywebsite.com/admin/index.php。我应该添加什么以允许访问管理文件夹?

它在本地主机上工作,但不在线。

RewriteEngine on
RewriteBase /
RewriteCond %{SCRIPT_FILENAME} !-f    
RewriteCond %{SCRIPT_FILENAME} !-d    
RewriteRule ^([^/]+)/?(.*)$ /?urlget=$1&$2

如果你想直接访问你的管理文件夹,那么首先添加测试:

RewriteEngine on
RewriteBase /
RewriteRule ^admin/index'.php$ - [L]
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^([^/]+)/?(.*)$ /?urlget=$1&$2

在这种情况下,如果请求是admin/index.php,它将在不检查其余条件的情况下到达那里。