Missing slash on URL?

Floren Munteanu nginx at yqed.com
Sat May 24 23:43:17 MSD 2008


There is something wrong, when I try to access this location, for example:

http://localhost/forum

 

Normally, if I access the above URL, it will automatically add at the end a
slash:

http://localhost/forum/

 

The page displays OK. How would I automatically add a / at the end of each
URL, only if it misses and an actual file is not called from URL? For
example:

http://localhost/forum will turn into http://localhost/forum/ while
http://localhost/forum/test.php remains unchanged.

 

localhost.conf

---------------------------------

server {

      listen                        80;

      server_name                   localhost;

      #charset                      koi-utf;

      access_log                    /var/log/nginx/localhost.access.log
main;

 

      location / {

            root                    /var/www/html;

            index                   index.php index.html;

 

            if (-f $request_filename) {

                  break;

            }

 

            if (!-e $request_filename) {

                  rewrite ^.*$ /404.html last;

            }

      }

 

      error_page                    404 /404.html;

      location = /404.html {

            root                    /var/www/html;

      }

 

      error_page                    500 502 503 504 /50x.html;

      location = /50x.html {

            root                    /var/www/html;

      }

 

      location ~ \.php$ {

            fastcgi_index           index.php;

            fastcgi_pass            127.0.0.1:9000;

            fastcgi_param           SCRIPT_FILENAME
/var/www/html$fastcgi_script_name;

            include                 /etc/nginx/fastcgi.conf;

      }

}

 

Thanks for your advice.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20080524/a87f0770/attachment.html>


More information about the nginx mailing list