View Single Post
  #5  
Old 9th July 2013, 19:10
cbj4074 cbj4074 is offline
Senior Member
 
Join Date: Nov 2010
Posts: 386
Thanks: 28
Thanked 58 Times in 50 Posts
Default

Okay, so I modified the main domain name so that it includes the www. To be clear, I changed it from "example2.com" to "www.example2.com" in the Clients -> Domains interface.

(It is important to note that I have www.example1.com on this server, too, which is a completely unrelated domain.)

This "fixes" the problem of the CGI "SERVER_NAME" variable lacking the www prefix (it now reflects "www.example2.com", as expected), but there is an unintended side-effect: SEO redirects no longer function as expected.

After making this change, if I try to browse to example2.com (without the www), the SEO redirect, which I have set to "domain.tld => www.domain.tld", is not effective.

Not only is the redirect not effective, but browsing to example2.com redirects me to example1.com, which is a very bad scenario in a production environment. Visitors to one client's site see a different client's site.

I assume that this occurs because a symlink for example2.com doesn't actually exist in /etc/nginx/sites-available (nor should it; the symlink name is now www.example2.com), so nginx redirects the request to the "first domain, alphabetically, with a '100-' prefix" with no regard whatsoever for any SEO redirect that might be set for www.example2.com (e.g., "domain.tld => www.domain.tld").

Is this a case of "operator error"? Or is this an actual problem/bug?

Again, all I want is for the CGI variable "SERVER_NAME" to include the "www" prefix, without having to include the www subdomain in the main domain name. Not only is including the www in the main domain name redundant when SEO redirect is set, but doing this causes the SEO redirects to stop functioning altogether.

I suppose my only option is to add custom nginx configuration directives to set the SERVER_NAME manually, e.g., change:

Code:
fastcgi_param	SERVER_NAME		$server_name;
to

Code:
fastcgi_param	SERVER_NAME		www.$server_name;
(I haven't actually tested the above syntax, either.)
Reply With Quote