Reputation: 2700
I only want to redirect one page, my homepage, to some subdomain.
I addded these lines in my .htaccess
files,
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} #some rule
RewriteRule ^index.php$ http://subdomian.mydomain.com
But, something went wrong - here's the warning in error log:
RewriteRule: bad argument line '^'
How can I correct the redirect?
Upvotes: 0
Views: 410
Reputation: 3970
I may be wrong, but i do believe you need to mark your RewriteRule for external redirection even if it's a subdomain.
Try the following line:
RewriteRule ^index.php$ http://subdomian.mydomain.com [R]
Upvotes: 0
Reputation: 9007
You should remove the HTTP_USER_AGENT
, if that is exactly what it looks like. So, your final rule should look like this:
RewriteEngine on
RewriteRule ^index.php$ http://subdomian.mydomain.com [R=301]
Note that you should also include the 301 redirect flag.
Upvotes: 1