I am trying to redirect traffic coming from a specific domain inside my .htaccess file. It works fine unless I do this for a domain with a .to extension. Any idea what is going on here?
Produces error 500:
RewriteCond %{HTTP_HOST} ^(www\.)?domain\.to [NC]
RewriteRule ^.*$ /foo/bar [L]
Works fine:
RewriteCond %{HTTP_HOST} ^(www\.)?domain\.com [NC]
RewriteRule ^.*$ /foo/bar [L]
Since I do not know for sure which rule does produce rewrite loop, I can only suggest this approach at this moment:
Your attempt is not technically correct for 2 reasons:
$1);$1.. but you have no matching group setup (in other words$1will always be empty).If still nothing — please provide real htaccess … or try enabling rewrite debugging (
RewriteLogLevel 9) — but for this you have to have full control over Apache server, as this directive cannot be placed in .htaccess (only server config / virtual host context) + you will need to restart Apache to re-read configuration file.Try adding this rule somewhere on the top — where it will be appropriate: