Routes CodeIgniter

1

The default site route is " link " or " link "

When I go to the sign-in page, for example, I would like to access " link " instead of link " as the codeiginiter obliges ...

Can you change that?

.htacess

<IfModule mod_rewrite.c>

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

</IfModule>

config.php file

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

routes file is default

$route['default_controller'] = 'welcome';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;

Controller, name " Login "

class Welcome extends CI_Controller {

public function index()
{
    $this->load->view('index');
}

and View is inside a " login " folder that has a sign in .php     

asked by anonymous 01.07.2018 / 02:36

1 answer

2

There is a setting in the application/config folder in the config.php file that should be configured as follows:

/*
|--------------------------------------------------------------------------
| Index File
|--------------------------------------------------------------------------
|
| Typically this will be your index.php file, unless you've renamed it to
| something else. If you are using mod_rewrite to remove the page set this
| variable so that it is blank.
|
*/
$config['index_page'] = '';

But, your server must be configured url rewrite module.

Note that if you are using Xampp it must be badly configured, then use the PHP built-in server by configuring system environment variables and typing php -S localhost:8989 has a server running on that port (which may vary from computer to computer ) is a test server that already comes with PHP ( Starting with PHP 5.4.0 , the SAPI CLI provides a built-in web server. ) that works perfectly.

    
01.07.2018 / 02:56