When I run newly created Rai开发者_StackOverflow社区ls application on Apache, I can only access it's default front page ( standard app/public/index.html) file. When I try to run custom method via URI I get page not found. So I'm guessing that something is wrong with my .htaccess. Do I have to "open" it for every controller?
RewriteCond %{HTTP_HOST} ^example.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.example.com$
RewriteRule ^main(.*) "http\:\/\/127\.0\.0\.1\:12005\/$1" [P,L]
Edit: I'm adding mongrel log
Error calling Dispatcher.dispatch #<NoMethodError: private method `split' called for nil:NilClass>
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/cgi_process.rb:52:in `dispatch_cgi'
The problem is actually between Rails 2.3.x and Mongrel, instead of .htaccess
It was discussed & a solution was found (by monkey patching) at https://rails.lighthouseapp.com/projects/8994/tickets/4690#ticket-4690-43
Heh, Ruby on Rails does not care about .htaccess. Welcome to the MVC world :-) Most likely, you didn't define any routes inside rails. Or you're not using passenger.
First of all, you can change the first two rules to:
RewriteCond %{HTTP_HOST} ^(www\.)?example.com$
Also, the last rule doesn't need all those backslashes, and since there's a slash before your $1 you should have one in ^main(.*) too:
RewriteRule ^main/(.*)$ "http://127.0.0.1:12005/$1" [P,L]
Try if that works. i'm not sure what P does and how that works, so if the problem is in there I can't help you..
精彩评论