tp5.1apache隐藏index.php后,数据无法添加
配置 .htaccess文件
我使用的是宝塔
(之前的)配置文件
// 这是根目录, 不是public下的 是最外面的根目录
<IfModule mod_rewrite.c>
Options +FollowSymlinks -Multiviews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [L,E=PATH_INFO:$1]
</IfModule>
// public下的
<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>
(之后的)配置文件
// 根目录
<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>
// public 下的
<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>
auth/adminrule.html
本文介绍了如何在宝塔面板环境下为ThinkPHP 5.1 (TP5.1) 配置Apache服务器以隐藏index.php,并提供了一种可行的.htaccess文件配置方案。通过修改根目录及public目录下的重写规则,实现了URL美观的同时确保了网站功能正常。
770

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



