Question 1: If I have a domain name abc.com
, now I want to automatically jump to about when I type
abc.com in the browser. abc.com
, just like the official website of gitlab
.
What steps are needed to achieve this effect?
What knowledge is needed?
Question 2: If I now have a domain name abc.com
, there are two folder directories under the html
directory of nginx
, one is bbs
, one is wiki
, how to set it up to access under the
bbs directory when accessing
bbs.abc.com index
, what about opening index
in the wiki
directory when visiting wiki.abc.com
?
What steps are needed to achieve this effect?
What knowledge is needed?
Note: I will learn Nginx
, but I hope you can give me the knowledge I need first, or give me some tips and tell me what knowledge and steps are needed to achieve it. Thank you.
習慣沉默2017-05-16 17:13:08
Too many methods
The easiest thing is to set it during DNS resolution301跳转
或者302跳转
,将abc.com
跳转到about.abc.com
can also be set in nginx
server {
listen 80;
server_name abc.com;
return 301 https://about.abc.com$request_uri;
}
can also be set in the code, such as in js
中指定window.locatioin
, the back-end language response returns 301 and location, etc.
server {
listen 80;
server_name bbs.abc.com;
root path/to/bbs
index index.php index.html
#其他配置...
}
server {
listen 80;
server_name wiki.abc.com;
root path/to/wiki
index index.php index.html
#其他配置...
}
In fact, you don’t need much knowledge or steps. You can achieve the effect you want by just searching online. If you want to go deeper, please google for question 1url redirect
301
302
nginx
显式跳转
隐式跳转
等关键词
问题2请googlenginx 配置文件
大家讲道理2017-05-16 17:13:08
For question 1: Most resolution service providers have the "explicit URL forwarding" function. You can put abc.com
解析到about.abc.com
.
ringa_lee2017-05-16 17:13:08
Just a little google and you will get the answer immediately http://guge.suanfazu.com/sear...