如何让Symfony允许文件名作为模块的参数

Im trying to have a module that manages downloads for files, so when someone goes to site.com/download/filename.pdf it fires the download module with filename parameter as filename.pdf.

The problem is the rewrite rules on Symfony dont allow that, it would be rewritten. What would I need to add to .htaccess to prevent the rewriting of those urls for .doc and .pdf files? Ive included the .htaccess file below...

Thanks for the help!

S

Options +FollowSymLinks +ExecCGI

<IfModule mod_rewrite.c>
  RewriteEngine On

  # uncomment the following line, if you are having trouble
  # getting no_script_name to work
  RewriteBase /



  # we check if the .html version is here (caching)
  RewriteRule ^$ index.html [QSA]
  RewriteRule ^([^.]+)$ $1.html [QSA]
  RewriteCond %{REQUEST_FILENAME} !-f

  # no, so we redirect to our front web controller
  RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>

Create a wildcard route:

url:  /download/*

and point it to the download module. Whatever route that is entered starting with /download/ will automatically open your download module.

Thanks Jon, to add to that I also had to change the segment_separators on the route to stop the . being interpreted as a marker for another parameter, so added this to the route for this module in routing.yml: segment_separators: ['-', '/', '_']