0

I currently using CodeIgniter 3. It is working on my laptop. But when I upload it to my Centos 6.9 server... I encounter an error. I already check the mod_rewrite is loaded.

I want it to be like this URL/controller/method (no index.php after URL)

It shows me a 404 when i try to login which redirect me to this URL/gate/login

I also set this....
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';

My htaccess on /var/www/html/calllist


<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ /calllist/index.php?/$1 [L]
</IfModule>


My httpd.conf
DocumentRoot "/var/www/html"

<Directory />
  Options FollowSymLinks
  AllowOverride All
</Directory>

<VirtualHost *:80>
  ServerAdmin webmaster@xxxx.com
  DocumentRoot /var/www/html/calllist
  ServerName www.xxxx.com
  ErrorLog /var/www/html/calllist/error_log
  CustomLog /var/www/html/calllist/requests.log common
</VirtualHost>
Rain Lai
  • 170
  • 1
  • 9
  • I doubt that `/calllist/index.php` will be part of the URL... You probably want to redirect to `/index.php` only. – arkascha Jul 14 '17 at 12:23
  • http://URL/index.php/gate/login, it can load... i need the proper .htacess to hide this index.php. – Rain Lai Jul 14 '17 at 12:38
  • By CI 3, are you referring to CodeIgniter? If this is occuring using the `base_url()` function, make sure you set `$config['index_page']` to empty string in `application/config/config.php`. – owenvoke Jul 14 '17 at 12:56
  • yes, codeigniter 3. i already did that. on my local, everything is working correctly. when uploaded to server, then hell break loose lol. – Rain Lai Jul 14 '17 at 13:01

1 Answers1

0

i solved the issue. apparently on httpd.conf, there is another line i need to set to 'All'.

and i added this to my virtual host

<Directory "/var/www/html/calllist">
    Options FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>
Rain Lai
  • 170
  • 1
  • 9
  • Obviously you need to enable the interpretation of dynamic configuration files at all before you can use them. That is what the `AllowOverride` directive does. I suggest you take a look into the documentation of the tool you use. It is written in there all over the place :-) – arkascha Jul 14 '17 at 14:00
  • Well added, also a simple `FallbackResource /index.php` in the virtualhost instead of those rewrites would have also worked for you. Remember "Directory /" points to / in file system, that should never be given access. And .htaccess is NOT necessary, if you have access to the virtualhost don't use configurations for underprivledged users. – Daniel Ferradal Jul 15 '17 at 10:18