I'm moving a site from a Synology server to another, and want automatic redirect. I have virtual host on the syno, the site is in domain sub.domain.com. The new site is in newdom.com/sub. This is the httpd-vhost.conf-user file:
NameVirtualHost *:80
<VirtualHost *:80>
ServerName *
DocumentRoot /var/services/web
RewriteLog /volume1/web/logs/rewrite.log
RewriteEngine On
RewriteCond %{HTTP_host} ^(sub\.domain\.com) [NC]
RewriteRule (.*) [%1$1...] [R=301,L]
</VirtualHost>
<VirtualHost *:80>
ServerName sub.domain.com
DocumentRoot "/var/services/web/bugs"
ErrorDocument 403 "/webdefault/sample.php?status=403"
ErrorDocument 404 "/webdefault/sample.php?status=404"
ErrorDocument 500 "/webdefault/sample.php?status=500"
<Directory />
AllowOverride FileInfo Options
Options FollowSymLinks
Options SymLinksIfOwnerMatch
</Directory>
RewriteEngine on
Options +FollowSymLinks
RewriteRule ^(.∗)$ http://newdom.com/sub/$1 [R=301,L]
ErrorLog "/var/services/web/logs/error-bug.log"
</VirtualHost>
Restart Apache and... Nothing happens, no redirection
The rewrite log says:
10.10.10.60 - - [15/Jul/2010:10:53:41 +0200] [sub.domain.com/sid#1017a370][rid#102f6800/initial] (2) init rewrite engine with requested uri /
10.10.10.60 - - [15/Jul/2010:10:53:41 +0200] [sub.domain.com/sid#1017a370][rid#102f6800/initial] (3) applying pattern '^(.*?)$' to uri '/'
10.10.10.60 - - [15/Jul/2010:10:53:41 +0200] [sub.domain.com/sid#1017a370][rid#102f6800/initial] (1) pass through /
There's nothing in the error.log.
Any help?
You need RewriteLogLevel <some_number_greater_than_zero> to turn on logging for what's happening.
OK, this was an encoding problem in the configuration file... Redirect now works!