私は大きな問題を抱えています(私のサーバーの管理者でさえ、それを解決するのにいくつかの困難があるようです)。
cpanel(11.25.0-STABLE)を使用して、新しいRuby on Railsアプリケーションを作成しました。これは、元のURI(ポート番号付き)にアクセスすると正常に機能します。
そのuriをより「ユーザーフレンドリー」にするために、ポート番号を表示せずにRoRアプリケーションにアクセスするための書き直しを作成しました。
書き直したURIの.htaccessの内容
RewriteEngine on
RewriteCond %{HTTP_HOST} ^greendeers.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.greendeers.com$
RewriteRule ^.*$ "http\:\/\/127\.0\.0\.1\:12001%{REQUEST_URI}" [P,QSA,L]
app / controllers / helloworld_controller.rb
class HelloworldController < ApplicationController
def index
end
end
app / views / layouts / helloworld.html.erb
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<title><%= controller.controller_name %>: <%= controller.action_name %></title>
<%= stylesheet_link_tag 'scaffold' %>
</head>
<body>
<p style="color: green"><%= notice %></p>
<%= yield %>
</body>
</html>
app / views / helloworld / index.html.erb
<h1>HELLO WORLD</h1>
最初のページ(RoRによって作成された元のページ)は両方のURIで正常に機能しますが、コントローラーの1つにアクセスすると、htmlがレンダリングされず、代わりにhtmlコードが表示されます。
http://www.greendeers.com/helloworld
このページは、元のURIを使用して期待どおりにレンダリングされます(上記と同じ、ポート番号:12001)
両方のuriにアクセスすると、ログに同じことが表示されます。
HelloworldController#indexを処理しています(2010-07-1002:53:20の[Myip address]の場合)[GET]
レイアウト/helloworld内のレンダリングテンプレート
helloworld/indexのレンダリング
1msで完了(表示:1、DB:0)| 200 OK [ http://greendeers.com/helloworld]
あなたはそれを修正する方法についての手がかりを持っていますか?
申し訳ありませんが、現時点では投稿ごとに1つのリンクしか投稿できません:/