htaccess를 사용하여 원격 서버에서 파일 제공

htaccess를 사용하여 원격 서버에서 파일 제공

htaccess를 사용하여 이 작업을 수행할 수 있습니까?

사용자 접속 -> http://mydomaina.com/dir/filename

-> http:// mymainsite.com/anydir/mydomaina-filename의 내용이 표시됩니다.

나한테 htaccess 코드가 있었는데 작동하지 않는 것 같아. 뭔가 빠진 게 있는 것 같아

<IfModule mod_rewrite.c>
      RewriteRule ^dir/(.*)\.xml$ http://mymainsite.com/dir/%{HTTP_HOST}-$1.xml [P] 
 </IfModule>

감사해요

답변1

RTFM에드. 그것은 말했다:

^/somepath(.*) /otherpath$1 [P]                 doesn't make sense, not supported
...
^/somepath(.*) http://otherhost/otherpath$1 [P] http://otherhost/otherpath/pathinfo
                                            via internal proxy

그래서 작동해야 할 것 같습니다. 하지만..

Note: mod_proxy must be enabled in order to use this flag.

작동하지 않아

이는 의미 있는 오류 메시지가 아닙니다. 로그 파일에는 무엇이 표시되나요? 프록시 대신 리디렉션을 보내려고 하면 어떻게 되나요?

씨.

답변2

가장 먼저 떠오르는 것은 mod_rewrite가 켜져 있지 않다는 것입니다. 모듈을 로드하는 것만으로는 충분하지 않습니다. 구성 어딘가에서 RewriteEngine On이를 활성화해야 합니다.

http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewriteengine

관련 정보