VPS侦探论坛

 找回密码
 注册
查看: 6293|回复: 3

主域名没问题,但是主域下的子目录怎样做做301

[复制链接]
发表于 2011-11-2 11:13:41 | 显示全部楼层 |阅读模式

我的网站改了版后,子目录地址全变了,麻烦军哥下,子目录乍样做301啊,百度了好多方法都不行

比如: http://www.421351.com/a/mt  怎样跳转到  http://www.421351.com/cc

         http://www.421351.com/a/mv  怎样跳转到 http://www.421351.com/mv

麻烦军哥指点下,最好能把代码贴出来,谢谢

以下是我现在用的301代码,主域名能跳



server
{
  listen       80;
  server_name www.421351.com;
  index index.html index.htm index.php;
  root  /home/wwwroot/hy150;
  include dede.conf;
  location ~ .*\.(php|php5)?$
   {
    fastcgi_pass  unix:/tmp/php-cgi.sock;
    fastcgi_index index.php;
    include fcgi.conf;
   }
  location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
   {
    expires      30d;
   }
  location ~ .*\.(js|css)?$
   {
    expires      12h;
   }
  access_log off;
}
server {
    server_name 421351.com qqape.com www.qqape.com text.hy150.com;
    rewrite ^(.*) http://www.421351.com$1 permanent;
}
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
 楼主| 发表于 2011-11-2 14:00:58 | 显示全部楼层


自己顶上
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
发表于 2011-11-2 14:13:00 | 显示全部楼层

location ~* ^/bbs {
        rewrite ^/bbs/(.*)$ https://bbs.vpser.net/$1 permanent;
}

加在server段里,重启nginx就行了
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
 楼主| 发表于 2011-11-2 14:54:11 | 显示全部楼层



谢谢军哥,我试下
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-9-21 15:24 , Processed in 0.026654 second(s), 17 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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