Dot at the end of a parameter

Hello it's me again,

When I got a dot at the end of a parameter and with that the end of the url, the dispatcher isn't working. Do I have to prevent that or is this a bug in phalcon? Or what do I have to do? When I open follwing url, I just get a blank page with no php errors or something ...

http://mydomain/profile/unicorn.

Be sure you noticed the dot at the end of the url! Any help would be nice :) Thanks in advance!



4.0k

Few posible solutions:

1) Set default paths - no error but not expected page :)

2) With .htaccess in /public directory

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)\.$ /$1 [L,R=301]

3) $router->add("/profile/unicorn(\.+|)", ....);

4) $router->notFound(...)

$router->notFound(array(
    'controller' => 'error',
    'action' => 'notFound',
));

//Error controler action
public function notFoundAction()
{
    $originalRequestUri = $this->request->getServer('REQUEST_URI');
    $revRequestUri      = strrev($originalRequestUri);

    while (strpos($revRequestUri, '.') === 0) {
        $revRequestUri = substr($revRequestUri, 1, strlen($revRequestUri));
    }
    if ($originalRequestUri !== strrev($revRequestUri)) {
        $this->view->disable();
        $this->response->redirect(strrev($revRequestUri));
    }
}

5) Attach event manager

...



2.5k

Thanks Paulius! I just tested some solutions and found out that the problem only exists on the IIS Webserver. On Apache it works without any changes ... Anyone got similiar problems with IIS?