VPS侦探论坛

 找回密码
 注册
查看: 4531|回复: 2

关于具体页面的301

[复制链接]
发表于 2016-2-9 01:24:54 | 显示全部楼层 |阅读模式

请教军哥,我想将下面的这些分别301:

http://www.x.com/92857.html —301至— http://www.x.com/insights/92857.html

http://www.x.com/category/hr-training —301至—  http://www.x.com/insights/category/hr-training

http://www.x.com/category/hr-training/page/2 —301至—  http://www.x.com/insights/category/hr-training/page/2

我用的方法是:

       rewrite ^/(.*)$ http://www.x.com/insights/$1 permanent;
        rewrite ^/category/(.*)$ http://www.x.com/insights/$1 permanent;
        rewrite ^/category/(.*)/page(.*)$ http://www.x.com/insights/$1 permanent;

按这个方法 ,查看HTTP头这些页面确实被301了,可是整个网站却无法访问了,提示无法重定向,请问是不是我用法啦,谢谢军哥,在此祝军哥新年快乐!

[ 本帖最后由 winnieji 于 2016-2-9 14:12 编辑 ]
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2016-2-10 17:01:46 | 显示全部楼层

回复 1# 的帖子



这个是在主目录下面的不好弄,会造成重复重定向的错误
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2016-2-10 18:25:52 | 显示全部楼层

回复 2# 的帖子


主要是第一条,在主目录下,其他两条都好办,论坛里翻了好多军哥给别人的回复,经过钻研我已经弄成功啦,军哥看下是不是这样:

rewrite '^/([0-9]{5})\.html$' http://www.jiangshi369.com/insights/$1.html permanent;,

比如http://www.jiangshi369.com/92857.html现在已成功跳至http://www.jiangshi369.com/insights/92857.html

[ 本帖最后由 winnieji 于 2016-2-10 18:28 编辑 ]
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-3-29 16:10 , Processed in 0.026448 second(s), 16 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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