Hi Guys I want my all NON-WWW url request to move permanently and also rewrite to WWW and I have tried to follow existing solutions at these as well Nginx no-www to www and www to no-www but still it did not work for me.
e.g. I want example.com or example.com/* to rewrite to www.example.com or www.example.com/*
I am running PHP-FPM with nginx and memcache
below is my config
server {
listen 80;
server_name abc.com;
return 301 http://www.example.com$request_uri;
}
server {
listen 80;
server_name www.example.com;
root /srv/www/abc;
index index.php index.html index.htm;
.......
}
Below is my curl response
neel:~ nilesh$ curl -I http://example.com
HTTP/1.1 200 OK
Server: nginx/1.4.6 (Ubuntu)
Date: Fri, 21 Aug 2015 19:00:54 GMT
Content-Type: text/html; charset=utf-8
Connection: keep-alive
Vary: Accept-Encoding
X-Powered-By: PHP/5.5.9-1ubuntu4.11
X-Drupal-Cache: HIT
Etag: "1440178291-0"
Content-Language: en
X-Generator: Drupal 7 (http://drupal.org)
Link: <http://example.com/>; rel="canonical",<http://example.com/>; rel="shortlink"
Cache-Control: public, max-age=1800
Last-Modified: Fri, 21 Aug 2015 17:31:31 +0000
Expires: Sun, 19 Nov 1978 05:00:00 GMT
Vary: Cookie
Vary: Accept-Encoding