开发者

What's wrong with this rewrite rule (redirect a directory request to another server)?

开发者 https://www.devze.com 2022-12-10 05:51 出处:网络
I\'m try to redirect any request to mydomain.com/video/(.*) to video.mydomain.com/$1. I have the following rule:

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 r开发者_如何学编程ewrite rule which I have later which redirects all requests to index.php.


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/


You forgot one slash after the start anchor:

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

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号