# Dash in request url messes up regex?

**URL:** <https://www.ruby-forum.com/t/dash-in-request-url-messes-up-regex/242477>\
**Category:** NGINX\
**Created:** [June 26, 2015, 10:47am UTC](https://www.ruby-forum.com/t/dash-in-request-url-messes-up-regex/242477 "2015-06-26T10:47:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![musicdenotation](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ea666f/32.png) [@musicdenotation](https://www.ruby-forum.com/u/musicdenotation)\
**Post date:** [June 26, 2015, 10:47am UTC](https://www.ruby-forum.com/t/dash-in-request-url-messes-up-regex/242477/1 "2015-06-26T10:47:13Z")

</div>

I am requesting the url /magento-check.php and it gives me the php  
code instead of running it through fpm. Other php files work just  
fine. Seems like the dash is screwing with the php regex location and  
going through root location with try\_files, serving the php code.

```
    location ~* \.php(/.*)?$
    {
            if (!-e $request_filename) { return 404; }

            fastcgi_pass unix:/var/run/php-fpm/blah.sock;
            fastcgi_split_path_info ^(.*\.php)(/.*)?$;
            include fastcgi.conf;

            expires off;
    }

    location /
    {
            try_files $uri $uri/ =404;
            expires 28d;
    }

```

Live long and prosper,

Christ-Jan Wijtmans

> **[cjwijtmans - Overview](https://github.com/cjwijtmans)**
>
> cjwijtmans has 7 repositories available. Follow their code on GitHub.

> **[Log in or sign up to view](https://www.facebook.com/cj.wijtmans)**
>
> See posts, photos and more on Facebook.

[http://twitter.com/cjwijtmans](http://twitter.com/cjwijtmans)

---

<div class="post-metadata">

**Author:** ![Christ-Jan\_Wijtmans](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/82dd89/32.png) [@Christ-Jan\_Wijtmans](https://www.ruby-forum.com/u/Christ-Jan_Wijtmans)\
**Post date:** [June 26, 2015, 7:45pm UTC](https://www.ruby-forum.com/t/dash-in-request-url-messes-up-regex/242477/2 "2015-06-26T19:45:51Z")

</div>

On Fri, Jun 26, 2015 at 10:46:35AM +0200, Christ-Jan Wijtmans wrote:

Hi there,

> I am requesting the url /magento-check.php and it gives me the php  
> code instead of running it through fpm. Other php files work just  
> fine.

Does “curl -i [http://your-server/magento-check.php](http://your-server/magento-check.php)” show a http header  
which indicates that PHP is processing the file?

Is there any difference in response if you add “\<?php” at the start of  
the magento-check.php file?

## f

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