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

我们先来看看官方手册给出关于「URL 重写」的参考:

可以通过 URL 重写隐藏应用的入口文件 index.php ,Apache 的配置参考:

1、http.conf 配置文件加载 mod_rewrite.so 模块
2、AllowOverride Node 中将 None 改为 All
3、将下面的内容保存为 .htaccess 放置入口文件同级目录下


<IfModule mod_rewrite.c>
Options +FollowSymlinks -Multiviews
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?/$1 [QSA,PT,L]
</IfModule>

最后,我通过修改 ThinkPHP 入口文件同级目录下的 .htaccess 文件完成了救赎~

以上能解决出现 No input file specified 错误。

原文地址:https://segmentfault.com/a/1190000015681142

猜你喜欢

转载自www.cnblogs.com/lalalagq/p/9979832.html
今日推荐