php 去除路由中index.php 通过 .htaccess 文件

首先在入口文件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>

 【使用这种方式,首先要确认apache是否开启mod_rewrite 功能】 

猜你喜欢

转载自www.cnblogs.com/ningjiabing/p/10291144.html
今日推荐