Reputation: 833
I am developing my app using xampp, and everything works fine there. But when I upload it on a host (hostinger) and try accessing a specific page I get a 404 error.
The button linking me to that page (from a different controller) has this as a url:
array('url'=>'Yii::app()->createUrl("symptomHistory/patientSymptomHistory",array("id"=>$data->primaryKey))',
(it's a button in a gridview)
The action that it calls is the following:
public function actionPatientSymptomHistory($id)
{
//create model doctor request and search the database for a doctor request between the doctor user and
//the patient user
$doctorRequestModel = new DoctorRequests;
$doctorPatientRequest = $doctorRequestModel->findByAttributes(array('doctorID'=>Yii::app()->user->id, 'userID'=>$id, 'doctorAccepted'=>1));
//if there is an accepted doctor request between doctor and patient, show the patients's symptom history
if(isset($doctorPatientRequest))
{
$model = new Symptomhistory;
//model for the patients data
$patientModel = User::model()->findByPk($id);
//empty array to store all the user's symptoms
$symptomItems = array();
//find all symptomHistory records belonging to the user
$symptomHistoryModels = $model->findAllByAttributes(array('user_id'=>$id));
//loop through all the symptomHistory records that belong to the user
foreach($symptomHistoryModels as $symptom)
{
//switch case for event color. set color for each flag type
switch($symptom->symptomFlag)
{
case '1':
$symptomColor = '#A1EB86';
break;
case '2':
$symptomColor = '#CCCA52';
break;
case '3':
$symptomColor = '#F25138';
break;
default:
$symptomColor = '#36c';
}
//create event
$symptomItem=array('title'=>$symptom->symptomTitle,
'start'=>$symptom->dateSymptomFirstSeen,
'end'=>$symptom->dateSearched,
'symptomCode'=>$symptom->symptomCode,
'symptomHistoryID'=>$symptom->id,
'flag'=>$symptom->symptomFlag,
'color'=>$symptomColor
);
//copy symptomHistory event into array
array_push($symptomItems, $symptomItem);
}
//render patient history
$this->render('patientSymptomHistory',array(
'model'=> $model, 'patientModel'=> $patientModel, 'symptomHistoryEvents'=>$symptomItems
));
}
else //else throw exception
{
throw new CHttpException(403, 'You are not permitted to check this patient\'s Symptom History');
}
}
(sorry for the extra long code, but I honestly have no idea what might help and what might not).
I repeat I get a 404 error, not a 403 one.
Does anyone have any idea why I am getting this error? Thank you for your help :)
Upvotes: 2
Views: 484
Reputation: 1153
This is similar to this question here: Yii 1.14 controller from two parts in module produce 404 error
Differences between environments can lead to 404s of this nature, due to naming conventions with controllers. Since upper case and lower case characters have different ASCII values, certain environments will evaluate them differently.
In my experience, naming controllers following this pattern: FooController.php
, where the first letter and the "C" in Controller are capitalized and nothing else, seems to work in all environments.
Upvotes: 1