search
HomePHP FrameworkThinkPHPThinkPHP access path hides index.php problem

ThinkPHP access path hides index.php problem

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

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

如果问题还存在则需要查看并修改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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Atom editor mac version download

Atom editor mac version download

The most popular open source editor