큰 문제가 있습니다. (심지어 내 서버의 관리자도이를 해결하는 데 어려움이있는 것 같습니다).Ruby On Rails : 렌더링 대신 HTML 소스 코드 표시
내 cpanel (11.25.0-STABLE)을 사용하여 레일스 애플리케이션에 새로운 루비를 만들었습니다.이 루비는 원래의 URI (포트 번호 포함)에 액세스 할 때 제대로 작동합니다.
uri를 "사용자 친화적"으로 만들기 위해 포트 번호를 표시하지 않고 RoR 응용 프로그램에 액세스하기 위해 다시 작성했습니다. 내 다시 URI
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]
응용 프로그램/컨트롤러/helloworld_controller.rb
class HelloworldController < ApplicationController
def index
end
end
응용 프로그램/뷰/레이아웃/helloworld.html.erb 내 htaccess로의
내용
<!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 모두에서 정상적으로 작동하지만 내 컨트롤러 중 하나에 액세스 할 때 html이 렌더링되지 않고 대신 html 코드가 표시됩니다.
http://www.greendeers.com/helloworld
이 페이지를 렌더링 (포트 번호를 갖는 상기와 동일 : 12001) 원래 URI를 사용하여 예상 :
두 URI에 액세스 할 때
내 로그 표시 똑같은 HelloworldController # index 처리 중 (내 [내 IP 주소] 2010-07-10 02:53:20) [GET]
레이아웃 내의 렌더링 템플릿/helloworld
렌더링 helloworld/index
1ms로 완료 (보기 : 1, DB : 0) | 200 OK [http://greendeers.com/helloworld]
수정 방법에 대한 단서가 있습니까?
미안 해요, 난 단지 그 순간에 게시물 당 하나 개의 링크를 게시 할 수 있습니다 : 당신이 심하게 당신의 .htaccess를 사용하기 때문에/
이 URL에 더 이상 액세스 할 수 없습니다. 해결책을 설명해 주시겠습니까? –
@etienne - 레일 이슈가 Lighthouse에서 GitHub로 마이그레이션 된 것 같습니다 : https://github.com/rails/rails/issues/404 [here] (https : //)의 어딘가에서이 문제를 추적 할 수 있습니다. github.com/rails/rails/issues?sort=created&direction=desc&state=open&page=1). 슬프게도 이전 이슈 ID를 이월 한 것처럼 보이지 않습니다. [This might] (http://mail-archives.apache.org/mod_mbox/httpd-users/201011.mbox/%[email protected]%3E) 도움. – Kev