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:



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



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

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




server {

      listen                        80;

      server_name                   localhost;

      #charset                      koi-utf;

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


      location / {

            root                    /var/www/html;

            index                   index.php index.html;


            if (-f $request_filename) {




            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  ;

            fastcgi_param           SCRIPT_FILENAME

            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