VPS侦探论坛

 找回密码
 注册
查看: 4480|回复: 8

[提问] 进来看看,简单问题,我不会。!帮帮忙

[复制链接]
发表于 2017-3-30 16:46:35 | 显示全部楼层 |阅读模式

怎么把用www.xxx.com 302.跳转到www.xxx.com/index.html   怎么写。和判断。。!
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2017-3-30 19:33:54 | 显示全部楼层


rewrite ^/(.*)$ https://lnmp.org redirect;
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2017-3-31 02:28:02 | 显示全部楼层

回复 2# 的帖子


需要把默认index.html 文档去掉吗?
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
 楼主| 发表于 2017-3-31 03:04:52 | 显示全部楼层

回复 2# 的帖子




我如果要把。/w/index.html 重写到根目录    是不是这样

location /w {
rewrite  /w/(.*)$  /$1 last;
rewrite  /(.*)$ https://lnmp.org redirect;
}
在浏览器是不是这样   https://lnmp.org/index.html
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
发表于 2017-3-31 10:05:09 | 显示全部楼层

location /w/ {
        rewrite  /(.*)$ https://lnmp.org/index.html redirect;
}

index.html 看你意愿了,如果目录下只有这一个index文件加不加都行

军哥运维代购:http://shop63846532.taobao.com/

 楼主| 发表于 2017-3-31 16:35:16 | 显示全部楼层

回复 5# 的帖子


我试试。。感谢军哥!!!!
 楼主| 发表于 2017-3-31 17:25:27 | 显示全部楼层

回复 5# 的帖子


server
    {
        listen 80;
        #listen [::]:80;
        server_name www.1.com;
        index index.html index.htm index.php default.html default.htm default.ph
p;
                root  /home/wwwroot/2;



                #include 1.com.conf;
            error_page   404   /max404.html;
        include enable-php.conf;

                location /w/ {
        rewrite  /(.*)$ http://www.1.com/index.html redirect;
                }



我这样还是不对啊。他跳转的。还是到了主域名 www.1.com的内容。。没有获取。。/w里面的内容啊。我是要这个域名获取。/w里面的内容!!!!意思就是要把W这个目录隐藏。。不在浏览器显示

[ 本帖最后由 yang2610278 于 2017-3-31 17:27 编辑 ]
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2017-3-31 20:51:17 | 显示全部楼层

回复 7# 的帖子


你前面说了半天的要302
没法隐藏,不允许访问的话就把rewrite规则改成deny all;
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2017-3-31 23:42:54 | 显示全部楼层

回复 8# 的帖子



是的,哥。。不是那样我。我也知道呀。。呵呵

军哥运维代购:http://shop63846532.taobao.com/

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|VPS侦探 ( 鲁ICP备16040043号-1 )

GMT+8, 2024-10-24 11:17 , Processed in 0.028048 second(s), 16 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表