PHP+Apache模式下路径index问题

省略index.php或者/index/方式

1:httpd.conf文件

LoadModule rewrite_module modules/mod_rewrite.so  这一句前面的#去掉

项目根目录下添加.htaccess

.htaccess文件内容为:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [L,E=PATH_INFO:$1]

 

如上的配置后:

http://w.xdx.m/index.php/index/ListProcess/joinBlacklist

该域名可以简化为:

http://w.xdx.m/index/ListProcess/joinBlacklist              //把indexl.php去掉

http://w.xdx.m/index.php/ListProcess/joinBlacklist      //把/index去掉

http://w.xdx.m/ListProcess/joinBlacklist                       //把/index.php/index都去掉

 

见截图:

 

 

 

参考答案:

 

posted on 2020-05-29 14:40  日月星辰$  阅读(282)  评论(0编辑  收藏  举报