apache to nginx rewrite rule

António P. P. Almeida appa at perusio.net
Wed Dec 29 18:37:55 MSK 2010


On 29 Dez 2010 15h30 WET, iberkner at gmail.com wrote:

> [1  <multipart/alternative (7bit)>]
> [1.1  <text/plain; ISO-8859-1 (7bit)>]
> Looking to do something like this:
>
> RewriteRule ^youtube/(.*)$ http://www.youtube.com/$1 [L]
>
> This the configuration I'm thinking of?
>
> location /youtube/
           ^^^^^^^^^

This means that you have a location /youtube not a host (vhost) youtube.com

> {
> rewrite ^(.*)$ http://www.youtube.com$1
> }

You seem to be confusing host (server_name) with location. That type
of rewriting must be done at the server (virtual host) level.

Cf. http://wiki.nginx.org/Pitfalls#Server_Name
 
--- appa




More information about the nginx mailing list