unix - Nginx url domain redirect -


with nginx, configure redirect between 2 domains this:

domaina.com/<anypath> domainb.com/redirect/<anypath>

my code right now:

server {     listen 80;     server_name .domaina.org(.*)$;     rewrite ^ http://domainb.org/redirect$1?; } 

the redirect domaina domainb works, doesn't include /redirect in new path. appreciated! thanks!

nginx has built-in functionality handle you. try this:

server {     listen 80;     server_name domaina.org;     return 301 http://domainb.org/redirect$request_uri; } 

Comments