作者:莪乜子12 | 来源:互联网 | 2023-08-15 10:41
前台隐藏index.php很简单. 官方就是api说明文档就有.htaccess的规则.
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
上面是隐藏index.php的规则 , 要是想隐藏admin.php后台入口的, 要加上下面这几行
RewriteRule admin$ ./admin.php [NC,L]
RewriteRule admin/$ ./admin.php [NC,L]
RewriteRule admin/(.*)$ admin.php/$1 [NC,QSA,PT,L]
最后变成这样:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
RewriteRule admin$ ./admin.php [NC,L]
RewriteRule admin/$ ./admin.php [NC,L]
RewriteRule admin/(.*)$ admin.php/$1 [NC,QSA,PT,L]