How to hide index.php in TP5

不言
Release: 2023-03-24 08:50:01
Original
4042 people have browsed it

这篇文章介绍的内容是关于TP5怎么隐藏index.php,有着一定的参考价值,现在分享给大家,有需要的朋友可以参考一下

tp5对URL简化,不做简化情况下我们访问的是localhost/index.php/index/index/index  ,做简化后省去index.php。

我们需要找到public下面的.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>
Copy after login


这样就可以直接访问localhost/index/index/index 了


The above is the detailed content of How to hide index.php in TP5. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!