代码片
去宝塔页面 > 网站 > 子网站 > 设置 > 伪静态
// 设置伪静态代码
location / {
if (!-e $request_filename){
rewrite ^(.*)$ /index.php?s=$1 last; break;
}
}
保存即可.

示例:
https://域名/index.php/admin/user/index.html
https://域名/admin/user/index.html
本文指导如何在宝塔控制台设置伪静态,通过示例和代码片段展示如何将非直接URL映射到PHP文件,便于SEO和URL管理。
去宝塔页面 > 网站 > 子网站 > 设置 > 伪静态
// 设置伪静态代码
location / {
if (!-e $request_filename){
rewrite ^(.*)$ /index.php?s=$1 last; break;
}
}
保存即可.

示例:
https://域名/index.php/admin/user/index.html
https://域名/admin/user/index.html

被折叠的 条评论
为什么被折叠?
