removing index.php in url with other webservers


I have seen ways to hide index.php in apache.

Recently i was playing around with nginx and cherokee. and i found ways to do this in those two as well.

for cherokee

Add a new rule in the behaviour tab.

It should be of type regular expression and a redirection.

make sure it is an internal redirection.

Regular expression substitution

^/myapplication/(.*)$ /myapplication/index.php/$1

for nginx

this is even easier than cherokee.

   location /myapplication {

      try_files $uri /myapplication/index.php;


I have been trying to get this done under lighttpd, but no luck so far. If anybody can do this, please do post back here.

I hope this can go to the yii docs, so that, users using different web servers can easily configure their app and spend more time in working with the fun of yii than get stuck with web server specifics.




I managed to configure the lighttpd too to be able to hide index.php.

url.rewrite-if-not-file = ( "^/myapplication/(.*)$" => "/myapplication/index.php/$1" )

If somebody finds a better way, please do add a reply here.



What does url.rewrite-if-not-file do? Does it work like [b]RewriteCond %{REQUEST_FILENAME} !-f

[/b] in Apache?

I used to do it with mod_magnet, see here.

// I see, looks like they finally added it - nice. Guess I will drop the mod_magnet hack then.


From what i gather at the website, as of now, lighttpd can only check for the existence of a file. It cannot check if a directory of that name exists.

and if you would carefully look into this, most times we only call either js or css or image files, so they would get called directly without index.php involved. and other times, we would call an action fromn the controller (which is not file). Yes , sometimes, we just call the controller and the default action is called. So it works fine.

Apache has tons of options. I wish they come out with a light version of apache or just make apache less of a memory hog.