I want to create routing for following urls.
Everything begins pdf
and ends with .pdf
site.com/en/pdf/aaa/bbb/file.pdf
site.com/pdf/aaa/bbb/file.pdf
site.com/pdf/file.pdf
...
My code is:
global_pdf:
class: myRequestRoute
url: /:sf_culture/pdf/*/*.pdf
param: { module: pdf, action: showEmbed }
requirements: { sf_method: get }
But it doesn't work.
How do that ?
Thank you.
You have four different scenarios your routing needs to cover:
The following routes should cover each of the above.
global_pdf_1:
class: myRequestRoute
url: /pdf/:filename.pdf
param: { module: location, action: test }
requirements: { sf_method: get }
global_pdf_2:
class: myRequestRoute
url: /pdf/:anything/:filename.pdf
param: { module: location, action: test }
requirements: { sf_method: get, anything: .* }
global_pdf_3:
class: myRequestRoute
url: /:sf_culture/pdf/:filename.pdf
param: { module: location, action: test }
requirements: { sf_method: get }
global_pdf_4:
class: myRequestRoute
url: /:sf_culture/pdf/:anything/:filename.pdf
param: { module: location, action: test }
requirements: { sf_method: get, anything: .* }