Redirect an url to other root on a multiple domain server
March 02, 2016 12:29PM
Hello,

I have a server with multiple domains (tendanza.com, canapes-design.com, canapes-pas-cher.com, etc), all the domains being used on the same website (different views).
I need to have www.canapes-design.com/blog/ to be a wordpress (I created a folder /var/www/blog/cd/) but I don't want the other domains to point on it.

I did this:

location /blog/ {
if ($host ~ canapes-design\.com) {
alias /var/www/blog/cd;
}
}

location /blog {
if ($host ~ canapes-design\.com) {
rewrite /blog(.*)$ /blog/$1 permanent;
}
}


and created an index.html in /var/www/blog/cd/blog, it works well.
But I also created a test.php but then I am redirected to a 404 on the main website.

I tried to do "root /var/www/blog/cd;" instead of "alias /var/www/blog/cd;", but it's the exactly same problem.

Would you know how I could fiw this, please?

Thank you,

François
Re: Redirect an url to other root on a multiple domain server
March 02, 2016 05:05PM
This works for a static file, yes? So this is a problem with how PHP is being served.

Please post more of your configuration, particularly for how you're serving PHP, and the contents of the error log for those requests

--
Jim Ohlstein
Re: Redirect an url to other root on a multiple domain server
March 03, 2016 04:12AM
Dear Jim,

thank you for your answer, I attach my full config to this message.
I added a wordress_fcgi.conf in conf and included it on the /blog/ location, but I guess I'm doing it wrong.

Thank you!

François
Attachments:
open | download - nginx.zip (16.7 KB)
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 117
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready