
다음과 같은 가상 호스트 파일이 있습니다.
<IfModule !wsgi_module>
LoadModule wsgi_module modules/mod_wsgi.so
WSGISocketPrefix run/wsgi
</IfModule>
<VirtualHost *:80>
RewriteEngine On
RewriteLog "/var/log/httpd/rewrite_log"
RewriteLogLevel 1
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,NE,L]
</VirtualHost>
<VirtualHost *:443>
ServerName https://tendril-api.dev.adnxs.net
ServerAlias 06.tendril-api.dev.nym2.adnexus.net/api
RewriteEngine on
RewriteRule ^docs$ docs/ [R]
...
# SSL & WSGI Setup
</VirtualHost>
어떤 이유로 My docs
Rewrite 규칙이 전혀 적용되지 않습니다. 왜 이런거야? *:80 VirtualHost의 HTTP-->HTTPS 다시 쓰기 규칙이 제대로 작동합니다. 나는 정말 비슷한 일을하고 있습니다.
서로 다른 VirtualHosts에 두 개의 서로 다른 재작성 규칙이 있는 것과 관련이 있습니까?
어떤 아이디어가 있나요?
답변1
에 따라http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewriterule:-
일치하는 것은 무엇입니까?
VirtualHost 컨텍스트에서 패턴은 처음에 호스트 이름과 포트 뒤, 쿼리 문자열 앞의 URL 부분(예: "/app1/index.html")과 일치합니다.
귀하의 패턴은 "docs"의 정확한 URL과 일치합니다. 실제 URL은 아마도 "/docs"일 것이므로 "^" 뒤에 "/"를 추가하면 작동할 수 있습니다.
RewriteRule ^/docs$ docs/ [R]