Search code examples
ruby-on-rails-3apache2passengerrefinerycms

anchor and refinery cms menu incorrect routing for sub uri


I have developed the ruby on rails application and am trying to deploy it using apache-passenger sub uri by referring this link. images, css and javascripts are working without any issues. But anchor tag and refinery cms other menu tabs are not working.

My anchor tag code is

<a href=<%= "#{request.env['HTTP-HOST']}/product_details/gotoLink/#{p1}/#{p2}" %> target="_blank" id="zoomid"></a>

I have mounted refinery cms on '/admin'. When I access it using http://mydomain.com/suburi, it will successfully logs in but when I click on menus like pages, files and etc I will get 404 error.

The same application will works fine without sub uri. Please Any one help me to fix this problem.

Thanks in advance


Solution

  • I referred this this url and issue is got fixed by doing the below changes

    I solved first problem like this

    rake RAILS_RELATIVE_URL_ROOT=/suburi assets:precompile RAILS_ENV=production
    

    RAILSapp -> config -> environments -> production.rb

    config.action_controller.relative_url_root = ENV['RAILS_RELATIVE_URL_ROOT']
    

    In views I did like this

    <a href=<%= "#{request.env['HTTP-HOST']}#{ENV['RAILS_RELATIVE_URL_ROOT']}/product_details/#{p1}/#{p2}" %> target="_blank" id="zoomid" >Link Name</a>
    

    For refinery I have added app->views->refinery->admin->_menu.html.erb

    <%= link_to plugin.title, refinery.url_for("#{ENV['RAILS_RELATIVE_URL_ROOT']}#{plugin.url}"),:class => ("active" if plugin.highlighted?(params)),:id => "plugin_#{plugin.name}" %>
    

    and in app -> views -> refinery -> _site_bar.html.erb

    <%= link_to "Home", "#{ENV['RAILS_RELATIVE_URL_ROOT']}" -%>
    

    My issues is got fixed. If this is not right approach then please tell me the right approach

    Thanks