Eu tinha a configuração do mantis como www.example.com/mantis e agora configurei meu httpd.conf para que ele seja acessível em: mantis.example.com. Como tenho muitos links que fazem referência aos links anteriores, preciso redirecioná-los para o novo local.
Isso é o que eu tenho como meu httpd.conf agora:
<VirtualHost MYSERVERIP:80>
ServerAlias EXAMPLE.com
DocumentRoot /var/www/html/beta
ServerName EXAMPLE.com
UseCanonicalName On
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteLogLevel 5
RewriteLog "/var/www/html/htaccess.log"
RewriteRule ^/mantis/(.*) http://mantis.EXAMPLE.com/$1 [L,R=301]
RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
...
</IfModule>
</VirtualHost>
...
<VirtualHost MYSERVERIP:80>
ServerAlias mantis.EXAMPLE.com
DocumentRoot /var/www/html/mantis
ServerName mantis.EXAMPLE.com
UseCanonicalName On
</VirtualHost>
No entanto, acessar o link leva a:
http://guide.opendns.com/main?url=www.mantis.EXAMPLE.com%2Fview.php%3Fid%3D17575
que mostra:
You tried to visit www.mantis.EXAMPLE.com, which is not loading.
Observe o www. parte. Eu não entendo de onde vem !!
Os logs do htaccess são os seguintes:
MYCLIENTIP - - [27/May/2011:09:40:57 +0000] [EXAMPLE.com/sid#2b4fab862578][rid#2b4fabeec150/initial] (2) init rewrite engine with requested uri /mantis/view.php
MYCLIENTIP - - [27/May/2011:09:40:57 +0000] [EXAMPLE.com/sid#2b4fab862578][rid#2b4fabeec150/initial] (3) applying pattern '^/mantis/(.*)' to uri '/mantis/view.php'
MYCLIENTIP - - [27/May/2011:09:40:57 +0000] [EXAMPLE.com/sid#2b4fab862578][rid#2b4fabeec150/initial] (2) rewrite '/mantis/view.php' -> 'http://mantis.EXAMPLE.com/view.php'
MYCLIENTIP - - [27/May/2011:09:40:57 +0000] [EXAMPLE.com/sid#2b4fab862578][rid#2b4fabeec150/initial] (2) explicitly forcing redirect with http://mantis.EXAMPLE.com/view.php
MYCLIENTIP - - [27/May/2011:09:40:57 +0000] [EXAMPLE.com/sid#2b4fab862578][rid#2b4fabeec150/initial] (1) escaping http://mantis.EXAMPLE.com/view.php for redirect
MYCLIENTIP - - [27/May/2011:09:40:57 +0000] [EXAMPLE.com/sid#2b4fab862578][rid#2b4fabeec150/initial] (1) redirect to http://mantis.EXAMPLE.com/view.php?id=17575 [REDIRECT/301]
Relacionados: link
Editar 1
Depois de alterar o httpd.conf para:
RewriteLogLevel 5
RewriteLog "/var/www/html/htaccess.log"
RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteRule ^/mantis/(.*) http://mantis.EXAMPLE.com/$1 [L,R=301]
Sem sorte ainda.
O arquivo de log é como:
MYCLIENTIP - - [27/May/2011:10:41:12 +0000] [EXAMPLE.com/sid#2b4fab856518][rid#2b4fabf06640/initial] (2) init rewrite engine with requested uri /mantis/view.php
MYCLIENTIP - - [27/May/2011:10:41:12 +0000] [EXAMPLE.com/sid#2b4fab856518][rid#2b4fabf06640/initial] (3) applying pattern '^' to uri '/mantis/view.php'
MYCLIENTIP - - [27/May/2011:10:41:12 +0000] [EXAMPLE.com/sid#2b4fab856518][rid#2b4fabf06640/initial] (4) RewriteCond: input='www.EXAMPLE.com' pattern='!^www\.' => not-matched
MYCLIENTIP - - [27/May/2011:10:41:12 +0000] [EXAMPLE.com/sid#2b4fab856518][rid#2b4fabf06640/initial] (3) applying pattern '^/mantis/(.*)' to uri '/mantis/view.php'
MYCLIENTIP - - [27/May/2011:10:41:12 +0000] [EXAMPLE.com/sid#2b4fab856518][rid#2b4fabf06640/initial] (2) rewrite '/mantis/view.php' -> 'http://mantis.EXAMPLE.com/view.php'
MYCLIENTIP - - [27/May/2011:10:41:12 +0000] [EXAMPLE.com/sid#2b4fab856518][rid#2b4fabf06640/initial] (2) explicitly forcing redirect with http://mantis.EXAMPLE.com/view.php
MYCLIENTIP - - [27/May/2011:10:41:12 +0000] [EXAMPLE.com/sid#2b4fab856518][rid#2b4fabf06640/initial] (1) escaping http://mantis.EXAMPLE.com/view.php for redirect
MYCLIENTIP - - [27/May/2011:10:41:12 +0000] [EXAMPLE.com/sid#2b4fab856518][rid#2b4fabf06640/initial] (1) redirect to http://mantis.EXAMPLE.com/view.php?id=17575 [REDIRECT/301]