title: How to route a request with extension to a specific Controller's action in CakePHP 2.2.0
body: <p>I'm using CakePHP 2.2.0 and I need to create one route that get this kind of page:</p>
  
  <pre><code>http://www.example.com/users/mypage.php
  </code></pre>
  
  <p>Following the cakephp documentation, I have found this page: <a href="http://book.cakephp.org/2.0/en/development/routing.html#file-extensions" rel="nofollow">http://book.cakephp.org/2.0/en/development/routing.html#file-extensions</a> </p>
  
  <p>where I read that I must to use:</p>
  
  <pre><code>Router::parseExtensions('php');
  </code></pre>
  
  <p>I have added this line in my routes.php file (above the routes), and than I added this route:</p>
  
  <pre><code>Router::connect('/users/mypage.php', array('controller' =&gt; 'users', 'action' =&gt; 'mypage'));
  </code></pre>
  
  <p>So, inside UsersController I added this action.</p>
  
  <p>Unfortunately, Only the requests sent to  <code>www.example.com/users/mypage</code> work good(the mypage action is called), If I try <code>www.example.com/users/mypage.php</code> I get a <strong>404 not found error</strong>.</p>
  
  <p>I really do not understand the reason, As the documentation says: </p>
  
  <blockquote>
    <p>This will tell the router to remove any matching file extensions, and
    then parse what remains.</p>
  </blockquote>
  
  <p>So, that's exactly what I need, I have to interpret (<strong>only for this action</strong>) that the <strong>mypage</strong> action is called when the user digits /users/mypage.php (with extension).</p>
  
  <p>I did not added anything else. AppController is as default, and my UsersController only has the mypage() method.</p>
  
  <p>I do not know if NGINX is the problem, I write the configuration of the domain below:</p>
  
  <pre><code>server {
          listen 80;
          server_name www.example.com;
          root /home/users/example.com/www/app/webroot/;
  
          access_log /home/users/example.com/log/access.log;
          error_log /home/users/example.com/log/error.log;
  
          location / {
                  index index.php index.html;
                  try_files $uri $uri/ /index.php?$uri&amp;$args;
          }
  
          location ~* \.php$ {
                  fastcgi_pass    127.0.0.1:9000;
                  fastcgi_index   index.php;
                  include         /etc/nginx/fastcgi_params;
                  fastcgi_param   SCRIPT_FILENAME    $document_root$fastcgi_script_name;
          }
  }
  </code></pre>
  
  <p>I think the question is clear, How to route the request to a specific Controller's action if the request has the extension ?</p>
  
  <p>I need:</p>
  
  <pre><code>www.example.com/users/mypage.php ==&gt; to UsersController mypage()
  </code></pre>