duanji1610 2011-03-08 11:15
浏览 42

如何让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>
  • 写回答

2条回答 默认 最新

  • douhua1890 2011-03-08 13:48
    关注

    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.

    评论

报告相同问题?