Configure .htaccess in Codeigniter CentOS 7 Server?

0

Cordial Greeting. Recently I'm working with the Codeigniter framework and a small web app, I use CentOS 7 to mount the application.

The problem is that I use the CodeIgniter URL helper to remove the index.php from the URL

de
http://midominio.com/index.php/miControlador/miFuncion
a
http://midominio.com/MiControlador/MiFuncion

Thing that using an old reliable as it is XAMPP in local (Windows) works with the following thing in the .htaccess

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

But when mounting the files to the server this does not work anymore, I modified the .htaccess with many variants found on the web but still I do not get it.

Error !!

http://midominio.com/cod/Welcome/page2

    
asked by Andros 05.07.2017 в 16:45
source

2 answers

1

You must add a question mark before the first parameter of the index, that is:

RewriteRule ^(.*)$ index.php/$1 [L]

a

RewriteRule ^(.*)$ index.php/?$1 [L]
    
answered by 10.08.2017 в 20:31
0

I currently have a web server with Code Igniter and I do not have the index.php

I pass my configurations:

.htaccess

# redirect from root to subdirectory
RedirectMatch ^/$ /directorio/

config.php

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

I think those are the necessary changes. Any questions comment!

    
answered by 18.08.2018 в 00:25