0
votes

I'm testing a Zend project on my shared-hosting.I keep everything inside a folder 'Zend-project' not on the server public-root (cause I have there another project!).

this is the structure:

/public_root
  /zend-project
    /application
      /configs
        application.ini
      /controllers
      /layouts
      /views
      bootstrap.php
    /css
    /images
    /javascript
    /zend-library
    .htaccess
    index.php

I had to tweak a little the project cause I just can't change my document_root on a shared-hosting so I edited the .htaccess to this:

RewriteEngine On
RewriteCond %{REQUEST_URI} ^/favicon.ico$ [OR]
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d 
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ /zend-project/index.php [NC,L]

but at the end everything seems to work fine except a single Url Route that I added to the router in my bootstrap.

edit:I tried creating a new controller 'TestController'..with a single action (called 'test')I tried to type the url with the controller lowercase (mysite.com/zend-project/test/test)and it's working!As I suspected there is something wrong with the 'index' word itself!cause any other controller works as a charme

this is bootstrap.php

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{

protected function _initRoutes()
{

    $frontController=Zend_Controller_Front::getInstance();
    $router=$frontController->getRouter();  
    $router->removeDefaultRoutes();
    $router->setGlobalParam('lang','en');
    $router->addRoute(
            'lang',
            new Zend_Controller_Router_Route(':lang/:controller/:action',
            array('lang'=>':lang',
            'module'=>'default',
            'controller'=>'index',
            'action'=>'index'

            )

            )
    );


            //the following route is not working remotely.
            //Is working on local environment
    $router->addRoute(
    'langController',
    new Zend_Controller_Router_Route(':controller/:action',
    array(

            'module'=>'default',
            'controller'=>'index',
            'action'=>'index'
            )

    )
);

            $router->addRoute(
    'langIndex',
    new Zend_Controller_Router_Route(':lang',
    array('lang'=>':lang',
            'module'=>'default',
            'controller'=>'index',
            'action'=>'index'
            )

    )
 );

            $router->addRoute(
    'langNothing',
    new Zend_Controller_Router_Route('',
    array(
            'module'=>'default',
            'controller'=>'index',
            'action'=>'index'
            )

    )
);

}
}

I tried to type the following urls (based on the custom routes I created)and everithing seems to work:

//this points to the pair controller/action -> index/index
mysite.com/zend-project/

//this points to the pair controller/action ->index/index in english lang
mysite.com/zend-project/en

//this points to the pair controller/action ->index/rooms in english lang
mysite.com/zend-project/en/index/rooms

But whenever I type:

mysite.com/zend-project/index/index 

I receive the following message: Not Found.The requested URL /zend-project/index/index was not found on this server.

It looks like the request doesn't reach the index.php file ..maybe an .htaccess problem??or what

thanks

edited

Found out that by typing the broken route's controller with capital letter it works :

//this works.Controller has capital letter
mysite.com/zend-project/Index/index 

//this do not work.Controller has not capital letter
mysite.com/zend-project/index/index

why?? (by the way I'm on linux server..)

1
this is strange problem. I wonder how mysite.com/zend-project/Index/index works as first index indicated about the module but you are not having index module.? Can you please put the class names your controller too?Awais Qarni
I specified a route 'langController' that handles situation when you type in :controller/:action..the point is in this case the controller has to be with Capital letter..my Index controller file is IndexController.php and the class name is IndexControllerluca
dude try the url like mysite.com/zend-project/langNothingAwais Qarni
I tried.it shows the index action..why??luca
Are you not going to access this action?Awais Qarni

1 Answers

0
votes

Remove this from httpd.conf

Options Includes ExecCGI MultiViews FollowSymLinks Indexes