Ci隐藏入口URL 中的 index.php

2019-02-12  本文已影响0人  _沒看懂

例如将URL: http://www.example.com/index.php/show/index去掉入口index.phphttp://www.example.com/show/index还可以继续访问,需要如下操作:

  1. 修改apache目录httpd.conf配置:打开LoadModule rewrite_module libexec/apache2/mod_rewrite.so,将AllowOverride noneAllowOverride All ,重启服务器sudo apachectl restart

  2. 在CI的目录下面创建.htaccess文件,加入如下内容:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
  1. 修改config.php的内容:$config['index_page'] = 'index.php';替换为$config['index_page'] = '';
上一篇 下一篇

猜你喜欢

热点阅读