Home  >  Article  >  Backend Development  >  How to hide index.php in TP5

How to hide index.php in TP5

不言
不言Original
2018-04-17 15:46:163991browse

这篇文章介绍的内容是关于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>


这样就可以直接访问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!

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