레일즈의 자동 버전 리소스에 대한 만료 헤더를 설정하려고합니다 (예 : whatever.css? 1234567890). (나는 버전없는 리소스에 대한 만료 헤더를 설정하고 싶지 않습니다.) 온라인에서 찾을 수있는 유일한 방법은 두 가지 단계가있었습니다. 1)/public 대신/public/add_expires_header에서 10 자릿수로 끝나는 모든 URL을 다시 쓰고, 여기서 add_expires_header는/public을 가리키는 심볼릭 링크입니다. 2) add_expires_header의 모든 파일에 만료일을 추가하십시오.Passenger/Apache : 버전이 지정된 리소스의 만료 헤더를 설정할 수 없습니다. (다시 쓰기 규칙이 인식되지 않습니다.)
승객이 아래의 말린 결과에 표시된 바와 같이 다시 쓰기 규칙을 인식하지 못하는 것 같습니다.
(참고 :. 많은 사람들이 그들이 FilesMatch를 사용하여 내 목표를 달성 할 수 생각하는 듯하지만 FilesMatch 쿼리 문자열을 볼 수 없습니다 다른 곳에서 읽기)
#from sites_enabled/sitename in the tags ... RewriteCond %{QUERY_STRING} ^[0-9]{10}$ RewriteRule ^(.*)$ /add_expires_header%{REQUEST_URI} [QSA] ExpiresActive On ExpiresDefault "access plus 1 years" ... ----- #curl indicates that rewrite rule isn't taking effect [email protected]:~$ curl -I -L "http://x.com/stylesheets/style.css?1249092148" HTTP/1.1 200 OK Date: Tue, 11 Aug 2009 04:07:49 GMT Server: Apache/2.2.11 (Ubuntu) Phusion_Passenger/2.2.4 PHP/5.2.6-3ubuntu4.1 with Suhosin-Patch Last-Modified: Sat, 01 Aug 2009 02:02:28 GMT ETag: "455b-2fbb-4700aedc5f500" Accept-Ranges: bytes Content-Length: 12219 Vary: Accept-Encoding Content-Type: text/css [email protected]:~$ curl -I -L "http://x.com/add_expires_header/stylesheets/style.css?1249092148" HTTP/1.1 200 OK Date: Tue, 11 Aug 2009 04:07:55 GMT Server: Apache/2.2.11 (Ubuntu) Phusion_Passenger/2.2.4 PHP/5.2.6-3ubuntu4.1 with Suhosin-Patch Last-Modified: Sat, 01 Aug 2009 02:02:28 GMT ETag: "455b-2fbb-4700aedc5f500" Accept-Ranges: bytes Content-Length: 12219 Cache-Control: max-age=31536000 Expires: Wed, 11 Aug 2010 04:07:55 GMT Vary: Accept-Encoding Content-Type: text/css
을 또한 포함 시도했다 apache2.conf, httpd.conf 및 public/.htacess의 다시 작성 내용