0

So i have posted similar question on stackoverflow but i think this is more appropriate section for this.

What i have now is one travel blog and on that blog i have whitelabel for tickets/booking.

whitelabel website is basically subdomain which is pointing to alias domain

So let's say my website is mytravelblog.com and whitelabel is whitelabel.otheragency.com and that is pointing to my subdomain which is in subfolder so

mytravelblog.com/tickets opens whitelabel.otheragency.com but i want to switch now for my whitelabel to be main website, but problem is they don't give robots.txt so i would have to deliver that and keep it on my hosting and also i want to keep my blog but just switch it to subfolder.

So whitelabel is giving me 2 methods to access their whitelabel, whitelabel.otheragency.com and resolve to their ip

Can i somehow do a redirection or proxy setup to resolve everything that is from whitelabel on my main domain but everything that is from subdirectory blog to my hosted blog website and robots.txt to my hosted robots.txt file.

So this is how it should be

mytravelblog.com open whitelabel.otheragency.com but still under my domain mytravelblog.com/tickets open whitelabel.otheragency.com/tickets and so for the rest of subfolders

mytravelblog.com/blog open my blog website that is on my hosting and any other subfolders mytravelblog.com/blog/10-most-beautiful-beaches to open my blog post mytravelblog.com/sitemap.xml opens my generated sitemap which i also host mytravelblog.com/robots.txt opens my generated robots.txt file.

lonerunner
  • 124
  • 1
  • 3
  • 16

1 Answers1

1

Maybe you are looking for something like this:

location / {
    ... other proxy_pass settings ...
    proxy_pass http://whitelabel.otheragency.com;
}

location = /robots.txt {
    try_files $uri =404;
}

location = /sitemap.xml {
    try_files $uri =404;
}

location /blog {
    try_files /path/to/front_controller =404;
}
Tero Kilkanen
  • 34,499
  • 3
  • 38
  • 58
  • I found solution like 30 minutes after posting this. And it's exactly as your suggestion, except i don't put =404 at the end, im guessing this is if page is not found fallback? Another problem i encounter is now i can't login to whitelabel website with this method. – lonerunner Mar 06 '18 at 04:56
  • I assume that is because the whitelabel website expects that it is accessed via `whitelabel.otheragency.com`, not `mytravelblog.com`. – Tero Kilkanen Mar 06 '18 at 05:44
  • no, it was working before, my logins and also new user registrations and bookings. It also works when i use DNS to resolve to their ip i just tested, but it's not working like this. I'll google around to find a solution if i can. – lonerunner Mar 07 '18 at 05:25