Welcome! Log In Create A New Profile

Advanced

Requests ending with / (slash) are returning 404

April 07, 2010 04:28AM
Hi all!

Can anyone with more experience give me hand? I've spent the last 4
hours trying many options and none of them worked, so I decided to ask
for help.

What i'm trying to do:
/foo/bar/page  served by /foo/bar/page.php

This one is working fine, as I can remove the.php extension from the
request and the page loads o (www.domain.com/page shows the content of
www.domain.com/page.php)

However, requests ending in a / (slash) are not working
/foo/bar/ served by /foo/bar/index.php
(www.domain.com/portal/ should show the content of
www.domain.com/portal/index.php)

I can't get this to work properly no matter what. I've tried if
conditions for the $request_uri, different location groups, flags for
the rewrite option and sadly i can't get it to work.

Can anyone with more experience give me a hand? Here's my conf file (snippet)


============
server
{
    listen   80;
    server_name www.domain.com.au;
    access_log /home/public_html/domain.com.au/log/access.log;
    error_log /home/public_html/domain.com.au/log/error.log error;
    root /home/public_html/domain.com.au/public;

    #file size
    client_max_body_size 100m;

    location = /
    {
        root   /home/public_html/domain.com.au/public/;
        index  index.php index.html;
    }

    location /
    {
        root   /home/public_html/domain.com.au/public/;
        index  index.php index.html;
        ####### ---- allows /foo/bar/page to /foo/bar/page.php
        rewrite ^([^.?]+)$ $request_uri.php last;
    }

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    location ~ \.php$
    {
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_intercept_errors on;
        fastcgi_index index.php;
        include /usr/local/nginx/conf/fastcgi_params;
        fastcgi_param SCRIPT_FILENAME
/home/public_html/domain.com.au/public/$fastcgi_script_name;
    }
}
============

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

Requests ending with / (slash) are returning 404

leocrespo April 07, 2010 04:28AM

Re: Requests ending with / (slash) are returning 404

Igor Sysoev April 07, 2010 04:44AM

Re: Requests ending with / (slash) are returning 404

edogawaconan April 07, 2010 04:54AM

Re: Requests ending with / (slash) are returning 404

Igor Sysoev April 07, 2010 05:02AM

Re: Requests ending with / (slash) are returning 404

leocrespo April 07, 2010 05:02AM

Re: Requests ending with / (slash) are returning 404

Igor Sysoev April 07, 2010 05:06AM

Re: Requests ending with / (slash) are returning 404

edogawaconan April 07, 2010 05:08AM

Re: Requests ending with / (slash) are returning 404

leocrespo April 07, 2010 05:14AM

Re: Requests ending with / (slash) are returning 404

edogawaconan April 07, 2010 05:20AM

Re: Requests ending with / (slash) are returning 404

leocrespo April 07, 2010 05:30AM

Re: Requests ending with / (slash) are returning 404

leocrespo April 07, 2010 05:34AM

Re: Requests ending with / (slash) are returning 404

Igor Sysoev April 07, 2010 05:50AM

Re: Requests ending with / (slash) are returning 404

Igor Sysoev April 07, 2010 05:48AM

Re: Requests ending with / (slash) are returning 404

leocrespo April 07, 2010 06:28AM

Re: Requests ending with / (slash) are returning 404

leocrespo April 07, 2010 06:44AM

Re: Requests ending with / (slash) are returning 404

edogawaconan April 07, 2010 06:50AM

Re: Requests ending with / (slash) are returning 404

leocrespo April 07, 2010 07:10AM

Re: Requests ending with / (slash) are returning 404

Igor Sysoev April 07, 2010 05:24AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 138
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready