我想有SEO优化的url像这样如何处理Rails资源路径中的点字符?
http://example.com/sites/1-blau.de/plans
但在路径事业轨道上的点到塞满。我如何使用百分比符号形式转义点,以便它可以工作?
我的路线:
resources :sites, only: [] do
resources :plans, only: [:index, :show] do
end
end
我试图URI.escape和CGI.escape,既不工作。
URI.escape('a.b')=> "a.b"
CGI.escape('a.b')=> "a.b"
我的想法,我想
Foo.escape('a.b')=> "a%2Eb"
你试过'反斜杠\\'? – Bala
@Bala你是什么意思? – lulalala
我认为他的意思是'\ .' – mdesantis