mahen3d
mahen3d

Reputation: 7754

Phalcon Routing exclude Routing to Controllers when File Exists

I have some css .map files directly under assets folder, however for some reason they failed to load and i get a 404 error in the dispatcher and router. Any solution on how to fix this issue ? i added following config to the router but still get the error.

$router->add(
    '/assets/css/dashboard-free.css.map'
); 

Error log says

example.com/assets/css/dashboard-free.css.map: 
2019-02-13 07:02:58: 
Phalcon\Mvc\Dispatcher\Exception: IndexController handler class cannot be loaded
 File=/var/.../Module.php
 Line=27
#0 [internal function]: Phalcon\Mvc\Dispatcher->_throwDispatchException('IndexController...', 2)
#1 [internal function]: Phalcon\Dispatcher->dispatch()
#2 /var/.../Module.php(27): Phalcon\Mvc\Application->handle()
#3 /var/.../web/index.php(12): Admin\Module->main()
#4 {main}

Upvotes: 0

Views: 367

Answers (2)

Talal
Talal

Reputation: 424

i don't think this has anything to do with phalcon or php i would check the css file for the map path

/*# sourceMappingURL=dashboard-free.css.map */

Upvotes: 0

Nikolaos Dimopoulos
Nikolaos Dimopoulos

Reputation: 11485

Apache

Try this in your .htaccess file

AddDefaultCharset UTF-8

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.+)\.(\d+)\.(bmp|css|cur|gif|ico|jpe?g|js|png|svgz?|webp|webmanifest)$ $1.$3 [L]

    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^((?s).*)$ index.php?_url=/$1 [QSA,L]
</IfModule>

nginx

location ~* (.+)\.(?:\w+)\.(bmp|css|cur|gif|ico|jpe?g|m?js|png|svgz?|webp|webmanifest)$ {
  try_files $uri $1.$2;
}

Upvotes: 0

Related Questions