繁体   English   中英

没有index.php的Codeigniter网址

[英]Codeigniter Url without index.php

我想创建一个应用程序网址“ http://example.com ”。 但是输入网址后,它会显示“ HTTP错误403.14-禁止访问”。 当我在网址的末尾(例如“ http://example.com/index.php ”)插入“ index.php”时,登录页面在浏览器中呈现,我已经更改了

$config['base_url'] = 'http://example.com';

$config['index_page'] = '';

$config['uri_protocol'] = 'REQUEST_URI';

在config.php文件中。 然后,我将.htaccess文件以及应用程序和系统文件夹放置在codeigniter根文件夹中。 然后在.htaccess文件中,我已经用

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

我只想从网址中删除“ index.php”。 我正在使用IIS 8.5 Web服务器。

在CI中,您可以在登录成功后设置会话数据:

$this->session->set_userdata('username' $this->input->post('username'))

您可以在注销时取消设置

$this->session->sess_destroy();

并使用数据库进行会话: https : //www.codeigniter.com/user_guide/libraries/sessions.html

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM