Tobias Schittkowski
Tobias Schittkowski

Reputation: 2251

How to disable routing in Symfony2 for certain paths/urls

I would like to call a php file directly from javascript in my SF2 application without routing/controllers.

The reason therefore is, that an external js framework (dhtmlx) has to call "generate.php" to produce an excel report. I put the generate.php under "vendors/dhtmlx/generate.php".

How can I call the generate.php file without a route?

I could implement a route to this file, but then the file is no controller object...

Upvotes: 3

Views: 3657

Answers (2)

You could use htaccess for that problem, i had a similar problem - i wanted that my api folder in the web folder get called directly and added this line into my .htaccess file

RewriteCond %{REQUEST_URI} "/api/"
RewriteRule (.*) $1 [L]

you could add something similar to you .htaccess like

RewriteCond %{REQUEST_URI} "/path/to/your/folder/"
RewriteRule (.*) $1 [L]

Upvotes: 0

PAStheLoD
PAStheLoD

Reputation: 995

This problem is, I think, something outside of Symfony's goals. Of course you can create a dummy controller for it which just includes generate.php (good if access control is desired), or use your webserver's URL-to-file mapping (mod_rewrite or mod_alias) and I would even recommend putting it on a different virtual host.

Upvotes: 5

Related Questions