Home>Article>PHP Framework> ThinkPHP access path hides index.php problem

ThinkPHP access path hides index.php problem

步履不停
步履不停 Original
2019-06-26 18:15:41 5001browse

ThinkPHP access path hides index.php problem

因为工作需要首次接触Tp,刚刚拿到项目就遇到一个问题。正常的管理后台能正常访问,但是前台跳转,不能正常访问。后经过排查,是因为本地的代码中没有设置忽略tp的index.php入口文件导致的。因为前端请求的接口都忽略了index.php;所以导致了请求接口的404错误。

在入口文件index.php的同级目录中增加一个.htaccess文件就解决了  RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L] 

如果问题还存在则需要查看并修改httpd-conf配置文件:
apache的配置文件没有将mod_rewrite.so模块加载。 \
将AllowOverride 的值改为All。

更多ThinkPHP相关技术文章,请访问ThinkPHP使用教程栏目进行学习!

The above is the detailed content of ThinkPHP access path hides index.php problem. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn