关于地址自动加www的问题
发布于 7 年前 作者 liangweidong 4981 次浏览 来自 问答

如果用户没加www,如何在程序上自动加www?

11 回复

@magicdawn 这是在解析域名里面设置的么?

@magicdawn 明白了,感谢大神们

	location / {
		# First attempt to serve request as file, then
		# as directory, then fall back to displaying a 404.
		#try_files $uri $uri/ =404;
		# Uncomment to enable naxsi on this location
		# include /etc/nginx/naxsi.rules
		if ($host != 'www.myfreax.com' ){
			rewrite  ^/(.*)$ http://www.myfreax.com/$1 permanent;
		}
		proxy_set_header   X-Real-IP $remote_addr;
		proxy_set_header   Host      $http_host;
	        proxy_pass         http://127.0.0.1:3000;
	}

我是在Nginx设置的

@huangyanxiong01 cnode也是在 nginx 做的

搞不清楚www和没有www的区别

自觉站在域名解析这一队了

@AserSayHi 站在域名解析一队+1 A记录 @ 暴力无脑

回到顶部