I am trying to remove the index.php segment from my project, but I can't. I tested several articles quoted here in StackOverflow, but still unable to.
This is my project structure:
(In /var/www/project directory)
project
--assets
--system
--.htaccess
--index.php
--info.php
--quickmenu.php
PHP version: 5.3.10
SO: Ubuntu 12.04
Apache version: 2.2.22
CodeIgniter: 2.1.3
My config.php file:
$config['base_url'] = "HTTP://".$_SERVER['HTTP_HOST']."/project/";
$config['index_page'] = "";
$config['uri_protocol'] = "REQUEST_URI";
$config['url_suffix'] = "";
$config['language'] = "portugues";
$config['charset'] = "iso-8859-1";
$config['enable_hooks'] = FALSE;
$config['subclass_prefix'] = 'MY_';
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
$config['enable_query_strings'] = FALSE;
$config['directory_trigger'] = 'd'; // experimental not currently in use
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';
$config['log_threshold'] = '1';
$config['log_path'] = '';
$config['log_date_format'] = 'Y-m-d H:i:s';
$config['cache_path'] = '/var/ci/cache/';
$config['encryption_key'] = "q7uP3mprMYuFFvbNcXyC6uPXs2ZUezxh";
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_encrypt_cookie'] = FALSE;
$config['sess_use_database'] = TRUE;
$config['sess_table_name'] = 'ci_sessions';
$config['sess_match_ip'] = FALSE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update'] = 300;
$config['sess_storage'] = 'database';
$config['sess_database'] = 'default';
$config['sess_timeout'] = 7200;
$config['sess_destroy_on_timeout'] = FALSE;
$config['sess_update_interval'] = 180;
$config['sess_gc_probability'] = 10;
$config['sess_http_only'] = FALSE;
$config['sess_secure'] = FALSE;
$config['sess_forwarded_ip'] = FALSE;
$config['cookie_prefix'] = "";
$config['cookie_domain'] = "";
$config['cookie_path'] = "/";
$config['global_xss_filtering'] = FALSE;
$config['compress_output'] = FALSE;
$config['time_reference'] = 'local';
$config['rewrite_short_tags'] = FALSE;
/* End of file config.php */
/* Location: ./system/application/config/config.php */
My .htaccess file:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /project/
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule>
Complement:
With the url doesn't work:
http://localhost/project/#../directory/controller/method
With these urls works:
http://localhost/project/#index.php/directory/controller/method
http://localhost/project/index.php/#directory/controller/method