Zend framework: “url not found” only with index controller, only if lowercase

不羁岁月 提交于 2019-12-23 12:26:42

问题


This is my problem:

I have a working zend application running on aruba/linux. It seems to work well.

I have some controllers: index, user, video, ...

if i type "http://www.foo.com/public/" i can reach my index controller and index action. if i type "http://www.foo.com/public/user/register" i can reach my user controller and register action.

if i type "http://www.foo.com/public/index/index" the server return url not found :(

But the most strange thing is that if i type "http://www.foo.com/public/Index/index" (pay attention on the UPPERCASE I) it works.

I try an explanation, but i don't found it :(

Can you help me??

Thanks in advance, Gabriele.

PS: in locale on my computer it works well


UPDATE

a behavior that i didn't notice this afternoon: if i call a controller that doesn't exist zend show the custom error page with write that there isn't the specified controller. With the index controller i obtain instead 404: url not found...

i absolutely don't know what to do... please help me!!


RE-UPDATE

I've changed the default controller from 'index' to 'foo', i have renamed all files, classes and folder correctly and the application works well, without this stupid error...

It seems that the 'index' word creates some kind of bug.. It's a kind of magic...


回答1:


I had the same problem.

The problem was in my Virtual host setting. I had the following settings in my Directory of my Virtual host:

<Directory /home/koen/zend/ZendCMS/public>
            Options Indexes FollowSymLinks MultiViews ExecCGI
            AllowOverride All
            Order Deny,Allow
            Allow from all
</Directory>

When I put a dash in front of MultiViews and that fixed the problem.

Like this:

<Directory /home/koen/zend/ZendCMS/public>
            Options Indexes FollowSymLinks -MultiViews ExecCGI
            AllowOverride All
            Order Deny,Allow
            Allow from all
</Directory>

Hope that helps




回答2:


Try to change your index url to Index/index rather than index/index apache2 by default in some configurations picks index as a default index.* file available in the document root




回答3:


I ran into the same issue when I upgraded from Apache 2.2 to 2.4. I basically copied over the httpd-vhosts.php file from one version to the next (after making the changes listed in the upgrade guide). My site worked fine for every page except /index, though the homepage would load if I left that off.

The answer provided by ArneRie in the original response thread is what resolved it for me. Removing MultiViews from the conf file cleared up the problem.




回答4:


I changed "/index" to "/Index" and it worked




回答5:


I had simillar problem today.

All other controllers works, also routes to index controller like this:

    $router->addRoute("object", 
        new Zend_Controller_Router_Route_Regex("object/(\d+)",
            array(
                "controller" => "index",
                "action"     => "object"
            )
        )
    );

works too.

But the /index/object show the 404 file not found error.

Must be something with the Options in vhost settings. I removed them totally and it helped in my case.

P.S.: Also you can direct your vhost on public folder so your links would look like: http://www.foo.com/user/register rather than http://www.foo.com/public/user/register



来源:https://stackoverflow.com/questions/9161455/zend-framework-url-not-found-only-with-index-controller-only-if-lowercase

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