# Requests ending with / (slash) are returning 404

**URL:** <https://www.ruby-forum.com/t/requests-ending-with-slash-are-returning-404/186444>\
**Category:** NGINX\
**Created:** [April 7, 2010, 10:25am UTC](https://www.ruby-forum.com/t/requests-ending-with-slash-are-returning-404/186444 "2010-04-07T10:25:14Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![leonardocg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/e274bd/32.png) [@leonardocg](https://www.ruby-forum.com/u/leonardocg)\
**Post date:** [April 7, 2010, 10:25am UTC](https://www.ruby-forum.com/t/requests-ending-with-slash-are-returning-404/186444/1 "2010-04-07T10:25:14Z")

</div>

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 ([Default title | Domain.com](http://www.domain.com/page) shows the content of  
[Default title | Domain.com](http://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/](http://www.domain.com/portal/) should show the content of  
[www.domain.com/portal/index.php](http://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; Â Â Â } }

---

<div class="post-metadata">

**Author:** ![leonardocg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/e274bd/32.png) [@leonardocg](https://www.ruby-forum.com/u/leonardocg)\
**Post date:** [April 7, 2010, 10:52am UTC](https://www.ruby-forum.com/t/requests-ending-with-slash-are-returning-404/186444/2 "2010-04-07T10:52:09Z")

</div>

2010/4/7 Igor S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> Â Â Â }

wouldn’t static files also passed to fastcgi in this case?

how about

location / {  
try\_files $uri @php;  
}  
location @php {  
try\_files $uri.php $uri/ =404;  
…fastcgi stuff…  
}

?

---

<div class="post-metadata">

**Author:** ![leonardocg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/e274bd/32.png) [@leonardocg](https://www.ruby-forum.com/u/leonardocg)\
**Post date:** [April 7, 2010, 10:58am UTC](https://www.ruby-forum.com/t/requests-ending-with-slash-are-returning-404/186444/3 "2010-04-07T10:58:35Z")

</div>

On Wed, Apr 07, 2010 at 03:50:47PM +0700, Edho P Arief wrote:

> > š š š}  
> > š š š š š š š /home/public\_html/domain.com.au/public/$fastcgi\_script\_name;  
> > location @php {  
> > try\_files $uri.php $uri/ =404;  
> > …fastcgi stuff…  
> > }
> 
> ?

Yes, you are right. Also you need to add

š šlocation ~ .php$ {  
…fastcgi stuff…

to prevent handling PHP files as static.

–  
Igor S.

> **[Igor Sysoev](http://sysoev.ru/en/)**

---

<div class="post-metadata">

**Author:** ![leonardocg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/e274bd/32.png) [@leonardocg](https://www.ruby-forum.com/u/leonardocg)\
**Post date:** [April 7, 2010, 10:41am UTC](https://www.ruby-forum.com/t/requests-ending-with-slash-are-returning-404/186444/4 "2010-04-07T10:41:02Z")

</div>

On Wed, Apr 07, 2010 at 06:24:36PM +1000, Leonardo C. wrote:

> request and the page loads o ([www.domain.com/page](http://www.domain.com/page) shows the content of
> 
> # ššš root /home/public\_html/domain.com.au/public; ššš location / ššš ššš 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; ššš } }

```
  location / {
      try_files $uri $uri.php $uri/ =404;

```

ššš ššš 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;  
}

or

```
  location / {
      try_files $uri $uri.php ${uri}index.php =404;

```

ššš ššš fastcgi\_pass 127.0.0.1:9000;  
ššš ššš fastcgi\_intercept\_errors on;  
ššš ššš include /usr/local/nginx/conf/fastcgi\_params;  
ššš ššš fastcgi\_param SCRIPT\_FILENAME  
/home/public\_html/domain.com.au/public/$fastcgi\_script\_name;  
}

–  
Igor S.

> **[Igor Sysoev](http://sysoev.ru/en/)**

---

<div class="post-metadata">

**Author:** ![leonardocg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/e274bd/32.png) [@leonardocg](https://www.ruby-forum.com/u/leonardocg)\
**Post date:** [April 7, 2010, 10:59am UTC](https://www.ruby-forum.com/t/requests-ending-with-slash-are-returning-404/186444/5 "2010-04-07T10:59:10Z")

</div>

Wow, very elegant Igor. Thank you, it works beautifully.

Could you help with the last bit?

I’d like to return 404 if the user tries /foo/page.php instead of  
/foo/page

I read the nginx wiki for try\_files  
([Module ngx\_http\_core\_module](http://wiki.nginx.org/NginxHttpCoreModule#try_files)) and coudn’t find  
the advanced syntax that you’ve given me to use (and that it works  
great). Is there any other nginx info resource that you could share?

Best,

Leonardo.

2010/4/7 Igor S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

---

<div class="post-metadata">

**Author:** ![leonardocg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/e274bd/32.png) [@leonardocg](https://www.ruby-forum.com/u/leonardocg)\
**Post date:** [April 7, 2010, 11:05am UTC](https://www.ruby-forum.com/t/requests-ending-with-slash-are-returning-404/186444/6 "2010-04-07T11:05:02Z")

</div>

On Wed, Apr 7, 2010 at 3:58 PM, Leonardo C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Wow, very elegant Igor. Thank you, it works beautifully.
> 
> Could you help with the last bit?
> 
> I’d like to return 404 if the user tries /foo/page.php instead of /foo/page

location / {  
try\_files $uri @php;  
}  
location @php {  
try\_files $uri.php $uri/ =404;  
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;  
}  
location ~ .php$ {  
return 404;  
}

–  
O\< ascii ribbon campaign - stop html mail - [www.asciiribbon.org](http://www.asciiribbon.org)

---

<div class="post-metadata">

**Author:** ![leonardocg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/e274bd/32.png) [@leonardocg](https://www.ruby-forum.com/u/leonardocg)\
**Post date:** [April 7, 2010, 11:04am UTC](https://www.ruby-forum.com/t/requests-ending-with-slash-are-returning-404/186444/7 "2010-04-07T11:04:27Z")

</div>

On Wed, Apr 07, 2010 at 06:58:19PM +1000, Leonardo C. wrote:

> Wow, very elegant Igor. Thank you, it works beautifully.
> 
> Could you help with the last bit?
> 
> I’d like to return 404 if the user tries /foo/page.php instead of /foo/page

location ~ .php$ {  
return 404;  
}

> I read the nginx wiki for try\_files  
> ([GitHub - nginxinc/nginx-wiki: ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com · GitHub](http://wiki.nginx.org/NginxHttpCoreModule#try_files)) and coudn’t find  
> the advanced syntax that you’ve given me to use (and that it works  
> great). Is there any other nginx info resource that you could share?

This wiki article is invalid, it should be fixed.  
Here is one example of try\_files usage:

> **[Converting rewrite rules](http://nginx.org/en/docs/http/converting_rewrite_rules.html#converting_mongrel_rules)**
>
> People who during their shared hosting life used to configure everything using only Apache’s .htaccess files, usually translate the following rules:

> > > # hours trying many options and none of them worked, so I decided to ask /foo/bar/ served by /foo/bar/index.php
> > > 
> > > ššš ššš ####### ---- allows /foo/bar/page to /foo/bar/page.php  
> > > ššš ššš fastcgi\_param SCRIPT\_FILENAME  
> > > šššš ššš fastcgi\_index index.php;  
> > > šššš ššš fastcgi\_pass 127.0.0.1:9000;
> > 
> > * * *
> > 
> > nginx mailing list  
> > [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> > [mailman.nginx.org archive](http://nginx.org/mailman/listinfo/nginx)
> 
> * * *
> 
> nginx mailing list  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> [mailman.nginx.org archive](http://nginx.org/mailman/listinfo/nginx)

–  
Igor S.

> **[Igor Sysoev](http://sysoev.ru/en/)**

---

<div class="post-metadata">

**Author:** ![leonardocg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/e274bd/32.png) [@leonardocg](https://www.ruby-forum.com/u/leonardocg)\
**Post date:** [April 7, 2010, 11:11am UTC](https://www.ruby-forum.com/t/requests-ending-with-slash-are-returning-404/186444/8 "2010-04-07T11:11:28Z")

</div>

Hi Edho, thanks.

Igor mentioned i should keep this to avoid serving php as static files.

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/boysdownunder.com.au/public/$fastcgi\_script\_name;  
}

Will it conflict with this?

> location ~ .php$ {  
> return 404;  
> }

Since i don’t want direct request to .php files anyway, I assume it  
won’t but just to be safe.

Cheers

---

<div class="post-metadata">

**Author:** ![leonardocg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/e274bd/32.png) [@leonardocg](https://www.ruby-forum.com/u/leonardocg)\
**Post date:** [April 7, 2010, 11:17am UTC](https://www.ruby-forum.com/t/requests-ending-with-slash-are-returning-404/186444/9 "2010-04-07T11:17:54Z")

</div>

On Wed, Apr 7, 2010 at 4:10 PM, Leonardo C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Â Â Â Â Â Â Â Â fastcgi\_param SCRIPT\_FILENAME  
> /home/public\_html/boysdownunder.com.au/public/$fastcgi\_script\_name;  
> Â Â Â Â }
> 
> Will it conflict with this?
> 
> > location ~ .php$ {  
> > Â return 404;  
> > }

as all php requests (usin are passed to @php block (or / block in  
Igor’s example), there shouldn’t be any problem.

And in my example it should be

try\_files $uri.php ${uri}index.php =404;

instead of

try\_files $uri.php $uri/ =404;

–  
O\< ascii ribbon campaign - stop html mail - [www.asciiribbon.org](http://www.asciiribbon.org)

---

<div class="post-metadata">

**Author:** ![leonardocg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/e274bd/32.png) [@leonardocg](https://www.ruby-forum.com/u/leonardocg)\
**Post date:** [April 7, 2010, 11:21am UTC](https://www.ruby-forum.com/t/requests-ending-with-slash-are-returning-404/186444/10 "2010-04-07T11:21:25Z")

</div>

On Wed, Apr 07, 2010 at 07:10:42PM +1000, Leonardo C. wrote:

> ```
> fastcgi_param SCRIPT_FILENAME
> 
> ```
> 
> won’t but just to be safe.  
> You should use the later variant.  
> The former should be used if you want to handle something like  
> “/foo/page.php”.

> > š š/home/public\_html/domain.com.au/public/$fastcgi\_script\_name;  
> > nginx mailing list  
> > [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> > [mailman.nginx.org archive](http://nginx.org/mailman/listinfo/nginx)
> 
> * * *
> 
> nginx mailing list  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> [mailman.nginx.org archive](http://nginx.org/mailman/listinfo/nginx)

–  
Igor S.

> **[Igor Sysoev](http://sysoev.ru/en/)**

---

<div class="post-metadata">

**Author:** ![leonardocg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/e274bd/32.png) [@leonardocg](https://www.ruby-forum.com/u/leonardocg)\
**Post date:** [April 7, 2010, 11:27am UTC](https://www.ruby-forum.com/t/requests-ending-with-slash-are-returning-404/186444/11 "2010-04-07T11:27:16Z")

</div>

I can’t make sense of those 2.

> try\_files $uri.php ${uri}index.php =404;

This means: if the uri is xxx, try to serve xxx.php. If you can’t,  
try serving xxxindex.php. If you can’t still, return 404.

> try\_files $uri.php $uri/ =404;

This means: if the uri is xxx, try to serve xxx.php. If you can’t,  
try serving xxx/ . If you can’t still, return 404.

Correct? They both work fine, what is the difference between them?

---

<div class="post-metadata">

**Author:** ![leonardocg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/e274bd/32.png) [@leonardocg](https://www.ruby-forum.com/u/leonardocg)\
**Post date:** [April 7, 2010, 11:30am UTC](https://www.ruby-forum.com/t/requests-ending-with-slash-are-returning-404/186444/12 "2010-04-07T11:30:47Z")

</div>

Just curious,

Why the {} in ${uri}index.php and not in $uri.php?

I’m assuming it’s to identify uri as a keyword, but wouldn’t it be  
necessary on the $uri.php as well?

---

<div class="post-metadata">

**Author:** ![leonardocg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/e274bd/32.png) [@leonardocg](https://www.ruby-forum.com/u/leonardocg)\
**Post date:** [April 7, 2010, 11:46am UTC](https://www.ruby-forum.com/t/requests-ending-with-slash-are-returning-404/186444/13 "2010-04-07T11:46:00Z")

</div>

On Wed, Apr 07, 2010 at 07:26:31PM +1000, Leonardo C. wrote:

> I can’t make sense of those 2.
> 
> > try\_files $uri.php ${uri}index.php =404;
> 
> This means: if the uri is xxx, try to serve xxx.php. If you can’t,  
> try serving xxxindex.php. If you can’t still, return 404.

Yes. Note, that ${uri}index.php is for “xxx/”, i.e. “xxx/index.php”.

> > try\_files $uri.php $uri/ =404;
> 
> This means: if the uri is xxx, try to serve xxx.php. If you can’t,  
> try serving xxx/ . If you can’t still, return 404.
> 
> Correct? They both work fine, what is the difference between them?

The trailing slash in “$uri/” tests that $uri, i.e., “xxx” or “xxx/”  
is a directory. Further directory handling depends on directives.

If you use

```
location / {
    try_file ... $uri/ ...
    index index.php;
}

```

then nginx will test index file for request, look

> **[How nginx processes a request](http://nginx.org/en/docs/http/request_processing.html#simple_php_site_configuration)**
>
> nginx first decides which server should process the request. Let’s start with a simple configuration where all three virtual servers listen on port \*:80:

If you use

```
location / {
    try_file ... $uri/ ...
    fastcgi_pass ...
    fastcgi_index index.php;
}

```

then nginx will add index.php to $uri in $fastcgi\_script\_name  
for request with trailing slash.

> > > š š š š š š š šfastcgi\_index index.php;
> > 
> > štry\_files $uri.php $uri/ =404;
> 
> * * *
> 
> nginx mailing list  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> [mailman.nginx.org archive](http://nginx.org/mailman/listinfo/nginx)

–  
Igor S.

> **[Igor Sysoev](http://sysoev.ru/en/)**

---

<div class="post-metadata">

**Author:** ![leonardocg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/e274bd/32.png) [@leonardocg](https://www.ruby-forum.com/u/leonardocg)\
**Post date:** [April 7, 2010, 12:25pm UTC](https://www.ruby-forum.com/t/requests-ending-with-slash-are-returning-404/186444/14 "2010-04-07T12:25:49Z")

</div>

Thanks Igor, it makes sense now. Thanks for the link it was helpful too.

Cheers

Leo

2010/4/7 Igor S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

---

<div class="post-metadata">

**Author:** ![leonardocg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/e274bd/32.png) [@leonardocg](https://www.ruby-forum.com/u/leonardocg)\
**Post date:** [April 7, 2010, 11:47am UTC](https://www.ruby-forum.com/t/requests-ending-with-slash-are-returning-404/186444/15 "2010-04-07T11:47:46Z")

</div>

On Wed, Apr 07, 2010 at 07:30:22PM +1000, Leonardo C. wrote:

> Just curious,
> 
> Why the {} in ${uri}index.php and not in $uri.php?
> 
> I’m assuming it’s to identify uri as a keyword, but wouldn’t it be  
> necessary on the $uri.php as well?

You may use ${uri}.php, but “.” means already the end of keyword.

> > This means: if the uri is xxx, try to serve xxx.php. šIf you can’t,
> > 
> > > > location ~ .php$
> > > 
> > > štry\_files $uri.php ${uri}index.php =404;  
> > > nginx mailing list  
> > > [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> > > [mailman.nginx.org archive](http://nginx.org/mailman/listinfo/nginx)
> 
> * * *
> 
> nginx mailing list  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> [mailman.nginx.org archive](http://nginx.org/mailman/listinfo/nginx)

–  
Igor S.

> **[Igor Sysoev](http://sysoev.ru/en/)**

---

<div class="post-metadata">

**Author:** ![leonardocg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/e274bd/32.png) [@leonardocg](https://www.ruby-forum.com/u/leonardocg)\
**Post date:** [April 7, 2010, 12:41pm UTC](https://www.ruby-forum.com/t/requests-ending-with-slash-are-returning-404/186444/16 "2010-04-07T12:41:38Z")

</div>

I’d to enable the php extension (/foo/page.php) when the url is  
domain.com.au/portal/admin\*

Here’s my failed attempt and the error I’m getting. I’ll make sure to  
keep reading as much as possible and not to ask questions that are  
already answered.

* * *

location / {  
try\_files $uri @php;  
}  
location @php {  
try\_files $uri.php ${uri}index.php =404;

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;  
}

## location ~ .php$ { #if the uri is not /portal/admin, return 404, disabling the php extension on the rest of the site if (!$uri ~\* /portal/admin) { return 404; } }

Starting nginx: [emerg]: invalid condition “!$request\_uri” in  
/usr/local/nginx/sites-enabled/domain.com.au:37

Not sure if the syntax is valid and also if I’m putting it in the  
right place as to avoid conflict with fastcgi.

Thanks again for the help.

Leonardo.

2010/4/7 Igor S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

---

<div class="post-metadata">

**Author:** ![leonardocg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/e274bd/32.png) [@leonardocg](https://www.ruby-forum.com/u/leonardocg)\
**Post date:** [April 7, 2010, 1:06pm UTC](https://www.ruby-forum.com/t/requests-ending-with-slash-are-returning-404/186444/17 "2010-04-07T13:06:14Z")

</div>

When i put this

location ~ ^/portal/admin/.\*.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;  
}

i get this error:

Starting nginx: [emerg]: directive “try\_files” is not terminated by  
“;” in /usr/local/nginx/sites-enabled/domain.com.au:26

line 26 is this: try\_files $uri.php ${uri}index.php =404;

When i remove this:

location ~ ^/portal/admin/.\*.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/boysdownunder.com.au/public/$fastcgi\_script\_name;  
}

The error dissapears… No idea what’s going on as one thing should  
affect the other and the error message is wrong, as I’m definitely  
ending the statement with a ;

---

<div class="post-metadata">

**Author:** ![leonardocg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/e274bd/32.png) [@leonardocg](https://www.ruby-forum.com/u/leonardocg)\
**Post date:** [April 7, 2010, 12:48pm UTC](https://www.ruby-forum.com/t/requests-ending-with-slash-are-returning-404/186444/18 "2010-04-07T12:48:05Z")

</div>

On Wed, Apr 7, 2010 at 5:40 PM, Leonardo C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> }

location ~ .php$ {  
return 404;  
}  
location ~ ^/portal/admin/.\*.php$ {  
…fastcgi stuff…  
}

> Not sure if the syntax is valid and also if I’m putting it in the  
> right place as to avoid conflict with fastcgi.

–  
O\< ascii ribbon campaign - stop html mail - [www.asciiribbon.org](http://www.asciiribbon.org)
