
Eu tenho o seguinte arquivo de host virtual:
<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>
Por algum motivo, docs
a regra My Rewrite não está entrando em vigor. Por que é isso? Minha regra de reescrita HTTP -> HTTPS no *:80 VirtualHost funciona corretamente. Estou fazendo algo realmente semelhante.
Isso tem a ver com duas regras de reescrita diferentes em VirtualHosts diferentes?
Alguma ideia?
Responder1
Conformehttp://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewriterule:-
O que é compatível?
No contexto VirtualHost, o padrão será inicialmente comparado com a parte da URL após o nome do host e a porta e antes da string de consulta (por exemplo, "/app1/index.html").
Seu padrão corresponde a um URL exato de "docs". O URL real é provavelmente "/docs", portanto, adicionar um "/" após "^" pode funcionar: -
RewriteRule ^/docs$ docs/ [R]