tags:

views:

128

answers:

2

I'm try to redirect any request to mydomain.com/video/(.*) to video.mydomain.com/$1. I have the following rule:

RewriteRule ^video/(.*)$  http://video.mydomain.com/$1 [R=301,L]

But it doesn't seem to work. Instead it follows an additional rewrite rule which I have later which redirects all requests to index.php.

+1  A: 

You forgot one slash after the start anchor:

RewriteRule ^/video/(.*)$  http://video.mydomain.com/$1 [R=301,L]
Eemeli Kantola
Only if the rewrite rule is in httpd.conf. If it's in .htaccess the OP's rule shouldn't have that slash.
cletus
Adding the slash doesn't work, just like cletus suspected.
blockhead
Can you give a bit more context, then? Otherwise it'll be too much guesswork. Where are the RewriteRules located in? Surrounded by what other conf?
Eemeli Kantola
+1  A: 

Not a direct answer to the question, but there is a simpler way to do this without mod_rewrite:

Redirect permanent /video http://video.mydomain.com/
Lukáš Lalinský
Still don't know the answer to my original question but, +1 For KISS!
blockhead