开发者

Url encode a dot (.) in URL?

开发者 https://www.devze.com 2023-03-27 05:29 出处:网络
Currently I am doing a small code in symfony that will cause url have resource like this: http://url/val/abc.abxhd

Currently I am doing a small code in symfony that will cause url have resource like this:

http://url/val/abc.abxhd

I was able to get the parameter abc successfully from http://url/val/abc, but w开发者_运维技巧hen I try to run the URL of http://url/val/abc.abxhd. Symfony simply throw a 404 error.

What could be the problem here. the URl are written using rawurlencode also.

group:
  url: /group/:group
  param: {module: group, action: show}
  requirements:
    sf_method: [get]


Actually symfony was finding dot (.) as a segment separator. This is the reason why in my case it cannot find the route. After Add the ff to my route. it works just like expected:

group:
  url: /group/:group
  param: {module: group, action: show}
  requirements:
    sf_method: [get]
  options:
    segment_separators: [/]


Seems like Symfony doesn't like dots . in urls : http://groups.google.com/group/symfony-users/browse_thread/thread/65d928b601bff9f4/096af0fcc478997b?pli=1

Users provide several tips and solutions.

What you can do is to handle this with url rewriting (as suggested in the thread) but take care not to rewrite files (meaningly: http://url/folder/myjquery.js)

0

精彩评论

暂无评论...
验证码 换一张
取 消