CodeIgniter Redirect issue

I am testing a server on http://example.com:8080, my CI app is here http://example.com:8080/app/

I have a port forward from 8080 (external) to 80 (internal)

My config.php looks like this:

...
$config['base_url'] = 'http://' . $_SERVER['HTTP_HOST'] . '/app';
...
$config['index_page'] = '';

How should look the .htaccess file in order to get the site working. Also I have used this https://www.codeigniter.com/userguide3/general/urls.html with success on port 80, but cant get it work on 8080. If I leave the index.php in the url then everything works well also on port 8080.

Thanks for any suggestion.

2 answers

  • answered 2017-12-06 04:24 Ghanshyam Bhava

    Try this .taccess:

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

    Its not clear your question why your redirect not working. Hope this help you. Always put what you have tried so far so everyone can understand better.

    Greetings!

  • answered 2017-12-06 04:58 Blue

    Finally I have found the issue... The rewrite module was not enabled, so I have enabled and everything works well.