php中关于ci框架修改后缀并去掉url中的index.php
在application文件中的config文件下的config.php文件,找到
$config['url_suffix'] = '';这一句就是添加你访问的后缀,如果这样子写
$config['url_suffix'] = '.html';那么你访问的时候在ci.com/index.php/welcome/index.html和
ci.com/index.php/welcome/index这两个访问都可以访问得到
第二:如何去掉访问中
ci.com/index.php/welcome/index.html的index.php我们只需要
ci.com/welcome/index.html这样子就能访问解决方法就是:
在ci框架文件下新建一个文件为.htaccess
里面的内容为:
RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
这样就完成了。