例如你的原路径是 http://localhost/index.php/home/index/index
你想要的访问的地址是 http://localhost/home/index/index
也就是去除index.php,方法如下:
1.httpd.conf配置文件中加载mod_rewrite.so模块 //在APACHE里面去配置
#LoadModule rewrite_module modules/mod_rewrite.so把前面的警号去掉
2.AllowOverride None 将None改为 All //在APACHE里面去配置
AllowOverride none 改 AllowOverride ALL(包括httpd.conf 和 httpd_vhost.conf中的)
Options None
Order allow,deny
Allow from all
3.确保URL_MODEL设置为2,(ThinkPHP/Conf/convention.php 第136行)
'URL_MODEL' => '2',
);
4 .htaccess文件必须放到跟目录下
这个文件里面加:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
5.重启wamp
绑定模块
原地址: http://localhost/home/index/index
现地址: http://localhost/index/index
入口文件中添加define('BIND_MODULE','Admin');