Welcome Guest, Not a member yet? Register   Sign In
.htaccess on an https server
#1

I am using codeigniter 3.1.11 for a school project. Locally, I have set-up this .htacces file

Code:
<IfModule mod_rewrite.c>
# deny from all
RewriteEngine On

RewriteCond $1 !^(index\.php|assets|images|js|css|uploads|favicon.png)
RewriteCond %(REQUEST_FILENAME) !-f
RewriteCond %(REQUEST_FILENAME) !-d

RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]
</IfModule>

With these settings :

PHP Code:
$config['base_url'] = 'http://localhost/codeigniter';

$config['index_page'] = '';

$config['uri_protocol']    = 'REQUEST_URI'
 
Locally, the rules work (i.e: localhost/codeigniter/welcome) takes me to the welcome page.

However, these same rules, do not work on the student server provided by my school.
Even after I have adapted everything, I still need to put index.php in the URL

PHP Code:
$config['base_url'] = 'https://'.$_SERVER['SERVER_NAME'].'/codeigniter'

If i try to access the welcome controller the same way I did locally, I only get back
Code:
File not found.

on the browser.

The servername follows this logic : studentNumber.SCHOOL_SERVER.com (connected via school vpn)

Any ideas?
Thanks
Reply
#2

The baseurl should have a trailing slash:

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

use absolute path on production like this: `'http://school_server.com/codeigniter/';`
Reply




Theme © iAndrew 2016 - Forum software by © MyBB