How to configure .htaccess when a rails application is located inside of another rails' public folder? -
i have rails application running on shared host server , public_html mapped ~/rails_apps/app1/public. done www.mydomain.com launches app1. expected, .htaccess this
rewritecond %{request_filename} !-f rewriterule ^(.*)$ dispatch.fcgi [qsa,l] here comes new rails app2, , want access through www.mydomain.com/app2
i created ~/rails_apps/app2, , created symlink public_html/app2 pointing there (the symlink ~/rails_apps/app1/public/app2).
this app2 needs dispatch.fcgi launch, app2/public/.htaccess has same rewriterules above.
the problem when access www.mydomain.com/app2/hello, first app1 receiving request , it's failing. i'm reading rule "file /app2/hello doesn't exist, send dispatch.fcgi processing".
so, tried setting additional rule in app1/public
rewritecond %{request_uri} ^/app2/.* rewriterule ^(.*)$ /app2/dispatch.fcgi [l] my app2 getting request, tries process /app2/hello fails since there no /app2 defined in routes. needs receive /hello.
i tried putting rewritebase /app2 before rules in above paragraph, didn't seem make difference. needed put rewritebase / before original app1 rewriterule, otherwise app1 breaks. (sincerely, don't know if more 1 rewritebase allowed)
any ideas how solve problem?
to adjust /app2 routes subdirectory try add
config.action_controller.relative_url_root = '/app2' to environmet.rb (production) ...
hope help
Comments
Post a Comment