Apache 里面隐藏TP框架地址中的index.php

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/odelia145/article/details/78970598

一.打开httpd.conf文件

1.#LoadModule rewrite_module modules/mod_rewrite.so  去掉前面#

2.<Directory "D:/server/apache/cgi-bin">
AllowOverride none改为 AllowOverride ALL(配置文件中的所有次句均改)
Options None
Order allow,deny
Allow from all
</Directory>

3.找到TP的项目配置文件conf.php,增加  'URL_MODEL' => '2'

4.在网站的根目录下新增.htaccess文件

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>

5.刷新网站即可

猜你喜欢

转载自blog.csdn.net/odelia145/article/details/78970598