简体   繁体   中英

Codeigniter Url without index.php

I want to create a app url ' http://example.com '. But entering the url, it shows 'HTTP Error 403.14 - Forbidden'. when i have inserted 'index.php' at the last of url like ' http://example.com/index.php ' the landing page is rendering in the browser I have changed the

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

$config['index_page'] = '';

and

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

in config.php file. Then i have placed the .htaccess file in the codeigniter root folder along with application and system folder. Then in the .htaccess file i have coded with

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

I just want to remove the 'index.php' from the url. I am using IIS 8.5 web server.

In CI you can set session data when login is successful:

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

you can unset at logout

$this->session->sess_destroy();

and use database for sessions: https://www.codeigniter.com/user_guide/libraries/sessions.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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