0

The following URL part works as expected on my Windows WAMP machine (running using AMPPS), but fails on the Linux production host:

index.php?r=customchocolates/index

I get the following error: Unable to resolve the request "customchocolates/index"

On Windows, I followed the naming convention of CustomChocolates in all the relevant files. However, after searching on-line, I changed the following files to: controller: customChocolatesController.php model: customChocolates.php views dir: customChocolates

I've also updated all the class names to the new name, but I'm still getting the error.

3 Answers 3

1

Windows = file name case insensitive

Linux = file name case sensitive

Change your route to customChocolates/index

Sign up to request clarification or add additional context in comments.

5 Comments

Thanks, @nkamm for a reply. Does that mean I have to also change all the other files, too? Cuz I tried your suggestion and it still gave me the same error...
Can you share the route in configuration?
im new to yii. can you explain what you mean by route in configuration? do routes need to be defined explicityly?
Routes are rules for CUrlManager. I prefer to define rules explicitly, but there is default pattern "Controller/Method". You changed your URL (not a route as I believe, i.e. you use this generic route). So try rename your file (as Mikhail said).
yiiframework.com/doc/guide/1.1/en/topics.url#user-friendly-urls Try rename your file and classname first. The problem of not rendered view is not in view, but in fact that Yii can't find your controller
1

Try to rename customChocolatesController.php to CustomChocolatesController.php, and be sure, that controller class name also CustomChocolatesController. And rename you route as nkamm says.

5 Comments

tried that when I first uploaded the site because that's how I had it on my Windows machine.. and it didnt work. Tried it again now.. again, didnt work...
Try to re-create file with controller on Windows machine with right file name, it may help.
I can't recreate the problem on my Windows machine.. whatever permutation of customchocolates I give it.. it renders the index view. =/
Have you upload newly created file from Windows to Linux machine? Be sure, that file with new file name appears in Linux machine
i got the site working on my Linux laptop. I can reproduce the error now. But I can't solve it. :(
0

Moved my site to my Linux laptop to reproduce the problem. Got the same problem as on production.

I solved it (I don't know why - perhaps someone more knowledgeable and experienced can explain) by doing the following:

  1. renamed controller file and class names to CustomchocolatesController
  2. Removed caseSensitive from URLManager block in config
  3. Renamed views folder to customchocolates

Thanks to @nkamm and @Mihail for their time last night.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.