PHP CodeIgniter application not opening any page except default controller

假如想象 提交于 2019-12-25 03:32:47

问题


My website was hosted on domain seeingtheworld.org and my htaccess was as follows:

php_value upload_max_filesize 1024M
php_value post_max_size 1024M
php_value max_execution_time 2700
php_value max_input_time 2700

Options +FollowSymlinks
RewriteEngine On
RewriteBase /seeingtheworld
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

This is the link working fine. http://seeing-the-world.org/

Now I have hosted this site on openshift

http://stw-ciapps.rhcloud.com/

It is only opening the home page and no other page. As I have specified home as default controller and do not know what I should change in htaccess for this openshift. If I have htaccess then why default root


回答1:


check with this code to your htaccess.

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

if its still not workings,try with changing "uri_protocol" in config file.




回答2:


Turns out my problem was somewhat unrelated. I had to rename my default controller php file to lowercase and the controller class name to lowercase and everything started to work. When CI looks for the default controller file, it searches in lowercase for the file; if I name my controller file "Home.php" instead of "home.php," CI misses it on Linux (since Linux file systems are case sensitive).



来源:https://stackoverflow.com/questions/30240994/php-codeigniter-application-not-opening-any-page-except-default-controller

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!