
Rails 2.3.18 애플리케이션이 에서 실행되고 http://0.0.0.0:3004/
있습니다.승객 모듈, 다음을 사용하여 Apache 서버에 배포 중입니다.프록시 모듈다음 구성을 사용합니다.
<VirtualHost *:80>
<Proxy *>
AllowOverride All
Allow from all
</Proxy>
ServerName mydomain.com
ServerAlias www.mydomain.com
DocumentRoot /path/to/my/app/public
<Directory /path/to/my/app/public>
Options +FolowSymLinks
AllowOverride All
Order allow, deny
Allow from all
RewriteEngine On
RewriteBase /
RewriteRule ^folder/(.*)$ /$1 [P]
</Directory>
ProxyPass / http://0.0.0.0:3004/
ProxyPassReverse / http://0.0.0.0:3004/
</VirtualHost>
구성에서 다음 규칙을 넣었습니다.모듈 다시 작성:
RewriteRule ^folder/(.*)$ /$1 [P]
http://mydomain.com/folder/...
이렇게 하면 으로 이동하는 모든 요청이 리디렉션되지만 http://mydomain.com/...
규칙이 작동하지 않기 때문입니다.
예를 들어 다음에서 이미지를 요청합니다.
http://mydomain.com/folder/images/image.jpg
목표는 다음으로 리디렉션하는 것입니다.
http://mydomain.com/images/image.jpg
하지만 작동하지 않습니다. 항상 첫 번째 경로를 사용합니다.
매우 감사합니다.
JT
답변1
귀하의 요청은 폴더로 시작하지 않고 슬래시로 시작됩니다.
RewriteRule ^/folder/(.*)$ /$1 [P]