How to hide index.php on nginx

You are viewing revision #6 of this wiki article.
This version may not be up to date with the latest version.
You may want to view the differences to the latest version or see the changes made in this revision.

« previous (#5)next (#7) »

In order to use path URL format and hide index.php on nginx+fastcgi+php, we need the following configurations.

First, we need to add PATH_INFO to the server configuration. Otherwise, we will not be able to use path URL format in Yii:

location ~ \.php {      
    fastcgi_index index.php;
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param PATH_INFO $fastcgi_script_name;
    access_log off;

Second, we need the following rewrite rule to hide index.php:

location /yiiGuestbook {
    if (!-e $request_filename){
        rewrite (.*) /yiiGuestbook/index.php/$1;

Please refer to the Guide for hiding index.php on Apache httpd server.

Links ΒΆ

Russian version

4 0
Viewed: 75 589 times
Version: Unknown (update)
Category: Tutorials
Tags: URL
Written by: miles
Last updated by: Darwin Wen
Created on: Feb 20, 2009
Last updated: 8 years ago
Update Article


View all history

Related Articles