Ver Mensaje Individual
  #1 (permalink)  
Antiguo 09/11/2012, 21:59
vani18
 
Fecha de Ingreso: junio-2010
Mensajes: 752
Antigüedad: 13 años, 11 meses
Puntos: 5
codeigniter htaccess URL amigables,

hola, estoy leyendo un tutorial de codeigniter, tal vez lo conozcan, hay pocos videotutoriales en español....
en el momento que tengo que hacer una prueba, voy a la pagina y se "llama" al controlador que esta prederteminado en routes, sucede que la clase, del controlador, tiene un metodo y en teoria tendria que acceder a ese metodo, escribir en la URL "/metodo" tambien luego se puede escribir "/parametros"

cuando escribo esto (hasta aca todo bien....)

http://localhost/InicioCI/

pero cuando quiero llamar al metodo que contiene esa clase....asi...

http://localhost/InicioCI/hola_mundo/hola_mundos

tira error mire todas las configuraciones.. etc, tengo activado el htaccess...

lo que si de esta manera puedo acceder...

http://localhost/InicioCI/index.php/...do/hola_mundos

-----------

aca estas los codigos.....

ROUTES.PHP
Código PHP:
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');


$route['default_controller'] = 'hola_mundo';
$route['404_override'] = '';


HOLA_MUNDO.PHP

Código PHP:
 <?php
class Hola_mundo extends CI_Controller {

       function 
__construct(){
      
parent::__construct();
   }

    function 
hola_mundos()    {
        echo 
'Hola mundos metodo';
    }
    public function 
index()    {
        echo 
'Hola mundo index';
    }
}
?>

.HTACCESS

Código PHP:
    <IfModule mod_rewrite.c>

        
RewriteEngine On
        RewriteBase 
/InicioCI/

        
RewriteCond %{REQUEST_URI} ^system.*
        
RewriteRule ^(.*)$ /InicioCI/index.php?/$[L]

        
RewriteCond %{REQUEST_URI} ^application.*
        
RewriteRule ^(.*)$ /InicioCI/index.php?/$[L]

        
RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond 
%{REQUEST_FILENAME} !-d
        RewriteRule 
^(.*)$ /InicioCI/index.php?/$[L]

    
##### rewrite exceptions
        
RewriteCond $!^(index.php|css|js|img|robots.txt)
        
RewriteRule ^(.*)$ /InicioCI/index.php/$[L]

    </
IfModule>

    <
IfModule !mod_rewrite.c>
        
ErrorDocument 404 /InicioCI/index.php
    
</IfModule

CONFIG.PHP

Código PHP:
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');


$config['base_url']= 'http://localhost/InicioCI/';


$config['index_page'] = '';


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



$config['url_suffix'] = '.html';


$config['language']    = 'english';


$config['charset'] = 'UTF-8';


$config['enable_hooks'] = FALSE;



$config['subclass_prefix'] = 'MY_';



$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';


$config['allow_get_array']        = TRUE;
$config['enable_query_strings'] = FALSE;
$config['controller_trigger']    = 'c';
$config['function_trigger']        = 'm';
$config['directory_trigger']    = 'd'// experimental not currently in use


$config['log_threshold'] = 0;


$config['log_path'] = '';


$config['log_date_format'] = 'Y-m-d H:i:s';


$config['cache_path'] = '';


$config['encryption_key'] = '';


$config['sess_cookie_name']        = 'ci_session';
$config['sess_expiration']        = 7200;
$config['sess_expire_on_close']    = FALSE;
$config['sess_encrypt_cookie']    = FALSE;
$config['sess_use_database']    = FALSE;
$config['sess_table_name']        = 'ci_sessions';
$config['sess_match_ip']        = FALSE;
$config['sess_match_useragent']    = TRUE;
$config['sess_time_to_update']    = 300;


$config['cookie_prefix']    = "";
$config['cookie_domain']    = "";
$config['cookie_path']        = "/";
$config['cookie_secure']    = FALSE;


$config['global_xss_filtering'] = TRUE;


$config['csrf_protection'] = TRUE;
$config['csrf_token_name'] = 'csrf_test_name';
$config['csrf_cookie_name'] = 'csrf_cookie_name';
$config['csrf_expire'] = 7200;


$config['compress_output'] = FALSE;


$config['time_reference'] = 'local';



$config['rewrite_short_tags'] = FALSE;



$config['proxy_ips'] = '';


no entiendo por que el " RewriteRule ^(.*)$ /InicioCI/index.php/$1 [L] "


no me elimina el INDEX.PHP...


gracias