My set up:
Radiant is running under mongrel with the prefix flag. --prefix /sub/dir
This makes /admin work (example.com/sub/dir/admin). (This also works
when Apache is proxying to mongrel, and mongrel has the prefix flag)
In environment.rb, I have added
ActionController::AbstractRequest.relative_url_root = “/sub/dir”
The changes to Radiant that are required was actually very simple once i
figured out where/how to do it.
In models/page_context.rb I added this method:
define_tag ‘url’ do |tag|
“#{ActionController::AbstractRequest.relative_url_root}#{tag.locals.page.send(:url)}”
end
and i removed the ‘+ [:url]’ from
((@page.attributes.symbolize_keys.keys + [:url]) - [:created_by,
:updated_by]).each do |method|
This also works when ActionController::AbstractRequest.relative_url_root
is not defined, because it’ll return “”.
This way any calls to <r:url>, <r:link>, etc generate urls with the
prefix.
I haven’t fully tested this, but so far everything seems to work fine.
Roydon G-B