I am making an application that handles folders and files in the title environment.
As for url, if it has the structure of folder A/folder B/file A,
I want url to be hoge.com/folder A/folder B/file A.
Route is, we have arranged as follows.

It is dispatched with push ("Folder A/Folder B/File A");
The first works well. However, folder A/folder B/file B in the same hierarchy as file A
Dispatch, hoge.com/Folder A/Folder B/Folder A/Folder B/File B
It will become. Apparently, it seems to rewrite below the/slash of the lowest layer.
In this case,
It works fine when dispatching file A from the state of hoge.com.
hoge.com folder A/folder B/file A
dispatch Then
in the state of the url hoge.com/Folder A/Folder B/This is rewritten.
hoge.com/Folder A/Folder B/Folder A/Folder B/File B

hoge.com/ be rewritten from here.
If there is any way, thank you.

The following method, it was useless.