当前位置: 首页 > 后端技术 > PHP

ThinkPHP5.XPHP5.6.27-nts+Apache通过URL重写隐藏入口文件index.php

时间:2023-03-29 19:44:35 PHP

先看官方手册,参考“URL重写”:可以通过URL重写隐藏应用入口文件index.php,Apache配置参考:1.http.conf配置文件加载mod_rewrite.so模块2.在AllowOverrideNode中将None改为All3,将以下内容保存为.htaccess,放在入口文件Options+FollowSymlinks-MultiviewsRewriteEngineonRewriteCond%{REQUEST_FILENAME}!-dRewriteCond%{REQUEST_FILENAME}!-fRewriteRule^(.*)$index.php?/$1[QSA,PT,L]最后,我完成了通过修改与ThinkPHP入口文件相同目录中的.htaccess文件进行赎回。以上可以解决Noinputfilespecified错误。