# Error 404 if url contains "star"

**URL:** <https://www.ruby-forum.com/t/error-404-if-url-contains-star/244435>\
**Category:** NGINX\
**Created:** [April 10, 2016, 7:17pm UTC](https://www.ruby-forum.com/t/error-404-if-url-contains-star/244435 "2016-04-10T19:17:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sadaf\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/858c86/32.png) [@Sadaf\_N](https://www.ruby-forum.com/u/Sadaf_N)\
**Post date:** [April 10, 2016, 7:17pm UTC](https://www.ruby-forum.com/t/error-404-if-url-contains-star/244435/1 "2016-04-10T19:17:15Z")

</div>

Hello,  
i have a very strange problem with my nginx configuration. If the URL  
contains the word “star”, i get the standard 404 Error not found page.  
I defined a rule that should redirect all requests to index.php.  
[http://example.com/some/url/starr](http://example.com/some/url/starr) → works, returns my custom styled  
error 404 page (processed by PHP)[http://example.com/some/url/star](http://example.com/some/url/star) →   
exact word “star”, returns default error 404 page (Request does not seem  
to go over PHP)  
The access\_log does not log the 404 Error, if the url contains the word.  
I changed to debug log levels but no logfileis showing something. Tried  
different nginx versions, server is running Debian 8.  
Any ideas?!  
Best regards, Alex

---

<div class="post-metadata">

**Author:** ![san](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ba9def/32.png) [@san](https://www.ruby-forum.com/u/san)\
**Post date:** [April 10, 2016, 8:37pm UTC](https://www.ruby-forum.com/t/error-404-if-url-contains-star/244435/2 "2016-04-10T20:37:52Z")

</div>

On Sun, Apr 10, 2016 at 07:16:33PM +0200, Alexander S. wrote:

Hi there,

> i have a very strange problem with my nginx configuration. If the URL contains  
> the word “star”, i get the standard 404 Error not found page.  
> I defined a rule that should redirect all requests to index.php.

> **[Module ngx\_http\_core\_module](http://nginx.org/en/docs/http/ngx_http_core_module.html#location)**
>
> This directive appeared in version 1.11.8.

Your rule does not redirect _all_ requests.

> Any ideas?!

There’s a missing backslash "" on the “location ~\*” line, just before  
the “.(”.

## f

Francis D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![san](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ba9def/32.png) [@san](https://www.ruby-forum.com/u/san)\
**Post date:** [April 10, 2016, 9:28pm UTC](https://www.ruby-forum.com/t/error-404-if-url-contains-star/244435/3 "2016-04-10T21:28:07Z")

</div>

Hello Francis,  
you are right. But the weird thing is, i already commented out that line  
(it was for caching/expires headers, and yes, missing the backslash).  
Is there any chance I was running two nginx instances? Because it seemed  
my configuration was kind of cached, as i commented that line, but it  
still didn’t work. Now, after i completely reinstalled nginx everything  
is working fine.  
I got the idea because i downgraded from newest nginx version to a older  
one in my testing. Is it possible that there were multiple instances?  
Anyway, thank you very much.

---

<div class="post-metadata">

**Author:** ![san](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ba9def/32.png) [@san](https://www.ruby-forum.com/u/san)\
**Post date:** [April 11, 2016, 11:24am UTC](https://www.ruby-forum.com/t/error-404-if-url-contains-star/244435/4 "2016-04-11T11:24:04Z")

</div>

The only way to know would have been to have a look at the processes  
table  
before killing everyone and restarting.  
If you nginx through the package management of your distribution and  
service scripts to manage nginx processus, there is little-to-no chance  
you  
got multiplt nginx masters running. It is however possible to spawn  
multiple nginx (master) instances if you manage you processes manually  
(and  
is useful when you do an on-the-fly upgrade). No multiple instances can  
bind to listen on the same ports though.

It would have been interesting to dig further, since you are saying the  
configuration was valid (as after restart nginx accepted/loaded it).

## In the current state, there is not much ability to conclude on anything. Maybe could you try to reproduce the problem by recreating your old configuration, loading it and trying to load the current configuraiton again? Remember to use `nginx -t` have a look at nginx’ error logs on reload to check the configuration has been accepted.

_B. R._

On Sun, Apr 10, 2016 at 9:27 PM, Alexander S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
