记录生活 学习SEO优化 | 他日若遂凌云志 敢笑黄巢不丈夫
>>Home > 学习笔记 > 二级域名利用htaccess301转向到同一空间域名

二级域名利用htaccess301转向到同一空间域名

Tags: | | 作者:海天无影

前几天海天因为论坛的域名绑定问题想大家求助了htaccess设置301定向转向的一个问题,当时看了网上很多的例子都不能用,海天也请了几位高手帮忙,可惜都没试验出来,最后想不到增加了两个括号就解决了……

来看看怎么样利用htaccess设置二级域名301定向转向到同一个空间下的另一个域名。

详细情况,海天在关于老域名权重高,想301定向转向这篇文章也说过了。
两个域名sqxy.net和sqxy.haitianhome.com是同时绑定在一个空间的,现在海天只想将sqxy.haitianhome.com这一个二级域名,301转向到sqxy.net这个独立域名上去。

在网上找了好几个代码,都不行,测试以后都提示循环重定向而打不开网页,最后海天无意中看到一段代码,修改了下,竟然行了……

成功的利用htaccess设置二级域名301定向转向到同一个空间下的另一个域名,代码如下:

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^(sqxy.)?haitianhome.com$
RewriteRule ^(.*)$ http://sqxy.net/$1 [R=301,L]

和其他代码相比只不过在二级域名sqxy.加了一个括号和问号,设置过后,宿迁学院论坛就能通过sqxy.net域名正常访问了,而二级域名sqxy.haitianhome.com也能够正常的301定向跳转。

送上一个域名重定向检测工具:http://www.ranknow.cn/tools/redirectcheck

如图所示,宿迁学院论坛的sqxy.haitianhome.com域名已经成功301定向转向到域名sqxy.net上了。

301定向转向检测工具

如图,海天的301定向转向已经成功

日志信息 »

该日志于2010-08-23 08:00由 海天无影 发表在学习笔记分类下, 你可以发表评论。除了可以将这个日志以保留源地址及作者的情况下转载到你的网站或博客,还可以通过RSS 2.0订阅这个日志的所有评论。

17条评论▼点击进行评论


  1. Warning: copy(/home/wwwroot/haitian/blog/avatar/80c6778d63af710963c2c43c81bbe833.jpg): failed to open stream: Permission denied in /home/wwwroot/haitian/blog/wp-content/themes/prowerV3.1/functions.php on line 169
    回复

    不错 还是指向顶级域名比较好


    • Warning: copy(/home/wwwroot/haitian/blog/avatar/3d58c5baea42043cdd0f012c22cfd774.jpg): failed to open stream: Permission denied in /home/wwwroot/haitian/blog/wp-content/themes/prowerV3.1/functions.php on line 169
      回复

      恩 这个老域名权重比较高 做个301 转一点过去 呵呵


  2. Warning: copy(/home/wwwroot/haitian/blog/avatar/971c5311eb70bddea71b423750c81e21.jpg): failed to open stream: Permission denied in /home/wwwroot/haitian/blog/wp-content/themes/prowerV3.1/functions.php on line 169
    回复

    难记的域名呵呵


    • Warning: copy(/home/wwwroot/haitian/blog/avatar/3d58c5baea42043cdd0f012c22cfd774.jpg): failed to open stream: Permission denied in /home/wwwroot/haitian/blog/wp-content/themes/prowerV3.1/functions.php on line 169
      回复

      呵呵 新域名就不难记了啊~


  3. Warning: copy(/home/wwwroot/haitian/blog/avatar/0dcedda7123567217b5ce259e203a209.jpg): failed to open stream: Permission denied in /home/wwwroot/haitian/blog/wp-content/themes/prowerV3.1/functions.php on line 169
    回复

    恭喜,呵呵,终于成功了。。。


    • Warning: copy(/home/wwwroot/haitian/blog/avatar/3d58c5baea42043cdd0f012c22cfd774.jpg): failed to open stream: Permission denied in /home/wwwroot/haitian/blog/wp-content/themes/prowerV3.1/functions.php on line 169
      回复

      呵呵 是啊 终于成功了~ ;-)


  4. Warning: copy(/home/wwwroot/haitian/blog/avatar/c4668a51a1479f6c344c7b79636c2236.jpg): failed to open stream: Permission denied in /home/wwwroot/haitian/blog/wp-content/themes/prowerV3.1/functions.php on line 169
    回复

    你也想换域名吗


    • Warning: copy(/home/wwwroot/haitian/blog/avatar/3d58c5baea42043cdd0f012c22cfd774.jpg): failed to open stream: Permission denied in /home/wwwroot/haitian/blog/wp-content/themes/prowerV3.1/functions.php on line 169
      回复

      额 已经换了
      给论坛新申请一个的~


  5. Warning: copy(/home/wwwroot/haitian/blog/avatar/12b9ca311887d0c56ef18c36e8dd5fbd.jpg): failed to open stream: Permission denied in /home/wwwroot/haitian/blog/wp-content/themes/prowerV3.1/functions.php on line 169
    回复

    恭喜恭喜


    • Warning: copy(/home/wwwroot/haitian/blog/avatar/3d58c5baea42043cdd0f012c22cfd774.jpg): failed to open stream: Permission denied in /home/wwwroot/haitian/blog/wp-content/themes/prowerV3.1/functions.php on line 169
      回复

      呵呵 感谢感谢~


  6. Warning: copy(/home/wwwroot/haitian/blog/avatar/8a696fb2b60f79867e39e7803303fc7a.jpg): failed to open stream: Permission denied in /home/wwwroot/haitian/blog/wp-content/themes/prowerV3.1/functions.php on line 169
    回复

    我叉,终于让你摸索成功了啊!


    • Warning: copy(/home/wwwroot/haitian/blog/avatar/3d58c5baea42043cdd0f012c22cfd774.jpg): failed to open stream: Permission denied in /home/wwwroot/haitian/blog/wp-content/themes/prowerV3.1/functions.php on line 169
      回复

      哈哈 是啊 现在301终于完美的从一个二级域名转了过来~ ;-)


  7. Warning: copy(/home/wwwroot/haitian/blog/avatar/40778ff2c73f96323537a02861912213.jpg): failed to open stream: Permission denied in /home/wwwroot/haitian/blog/wp-content/themes/prowerV3.1/functions.php on line 169
    回复

    呵呵,折腾成了,恭喜你!


    • Warning: copy(/home/wwwroot/haitian/blog/avatar/3d58c5baea42043cdd0f012c22cfd774.jpg): failed to open stream: Permission denied in /home/wwwroot/haitian/blog/wp-content/themes/prowerV3.1/functions.php on line 169
      回复

      呵呵 感谢~


  8. Warning: copy(/home/wwwroot/haitian/blog/avatar/3a6d76790a7f616507cedd378f3cabd4.jpg): failed to open stream: Permission denied in /home/wwwroot/haitian/blog/wp-content/themes/prowerV3.1/functions.php on line 169
    回复

    你那个宿迁学院也没几个人呀


    • Warning: copy(/home/wwwroot/haitian/blog/avatar/3d58c5baea42043cdd0f012c22cfd774.jpg): failed to open stream: Permission denied in /home/wwwroot/haitian/blog/wp-content/themes/prowerV3.1/functions.php on line 169
      回复

      还没开学 所以没有宣传
      等开学宣传~


  9. Warning: copy(/home/wwwroot/haitian/blog/avatar/b041fec6d9b41851a84ef29a4827c1d7.jpg): failed to open stream: Permission denied in /home/wwwroot/haitian/blog/wp-content/themes/prowerV3.1/functions.php on line 169
    回复

    这个讲得很好,很多东西只有自己折腾了才会弄得更清楚。我先收藏下,以后说不定就用到了。


    • Warning: copy(/home/wwwroot/haitian/blog/avatar/3d58c5baea42043cdd0f012c22cfd774.jpg): failed to open stream: Permission denied in /home/wwwroot/haitian/blog/wp-content/themes/prowerV3.1/functions.php on line 169
      回复

      呵呵 是啊 网上说的 好多都不行~
      还是适合自己的最好的


  10. Warning: copy(/home/wwwroot/haitian/blog/avatar/11c106aa2b44bb82bc316048b996ecd2.jpg): failed to open stream: Permission denied in /home/wwwroot/haitian/blog/wp-content/themes/prowerV3.1/functions.php on line 169
    回复

    这个非常好,要做好记录了


    • Warning: copy(/home/wwwroot/haitian/blog/avatar/3d58c5baea42043cdd0f012c22cfd774.jpg): failed to open stream: Permission denied in /home/wwwroot/haitian/blog/wp-content/themes/prowerV3.1/functions.php on line 169
      回复

      嘿嘿 希望以后能帮到你~


  11. Warning: copy(/home/wwwroot/haitian/blog/avatar/bf90f1504839fa07a72bb33a21c0932f.jpg): failed to open stream: Permission denied in /home/wwwroot/haitian/blog/wp-content/themes/prowerV3.1/functions.php on line 169
    回复

    不错的方法,


    • Warning: copy(/home/wwwroot/haitian/blog/avatar/3d58c5baea42043cdd0f012c22cfd774.jpg): failed to open stream: Permission denied in /home/wwwroot/haitian/blog/wp-content/themes/prowerV3.1/functions.php on line 169
      回复

      嘿嘿 适合的才是最好的~


  12. Warning: copy(/home/wwwroot/haitian/blog/avatar/b0ad080dbced9b0ec0cfb258b9bccc46.jpg): failed to open stream: Permission denied in /home/wwwroot/haitian/blog/wp-content/themes/prowerV3.1/functions.php on line 169
    回复

    那个htaccess文件是放在 sqxy.haitianhome.com 的根目录下吗?
    在index.html里用标签也能实现吧


    • Warning: copy(/home/wwwroot/haitian/blog/avatar/3d58c5baea42043cdd0f012c22cfd774.jpg): failed to open stream: Permission denied in /home/wwwroot/haitian/blog/wp-content/themes/prowerV3.1/functions.php on line 169
      回复

      哦 我两个域名是绑定同一个空间的
      所以网上说的那些 都不能用……


  13. Warning: copy(/home/wwwroot/haitian/blog/avatar/6ca915462446f456fbd0aee43069edd2.jpg): failed to open stream: Permission denied in /home/wwwroot/haitian/blog/wp-content/themes/prowerV3.1/functions.php on line 169
    回复

    :lol:

    海天最近推广宿迁论坛卓有成效吧。


    • Warning: copy(/home/wwwroot/haitian/blog/avatar/3d58c5baea42043cdd0f012c22cfd774.jpg): failed to open stream: Permission denied in /home/wwwroot/haitian/blog/wp-content/themes/prowerV3.1/functions.php on line 169
      回复

      唉 就是把排名搞上去了
      但是人气还不行啊 等开学去做宣传了


  14. Warning: copy(/home/wwwroot/haitian/blog/avatar/b0ad080dbced9b0ec0cfb258b9bccc46.jpg): failed to open stream: Permission denied in /home/wwwroot/haitian/blog/wp-content/themes/prowerV3.1/functions.php on line 169
    回复

    我还真得向你请教一下了,我最近开始做ResellerClub域名、空间的代理,销售站点的域名是新的,收录情况很不理想,我想像你一样,考虑用旧域名“提携”一下新域名,具体该怎么做,有什么好的思路呢?


    • Warning: copy(/home/wwwroot/haitian/blog/avatar/3d58c5baea42043cdd0f012c22cfd774.jpg): failed to open stream: Permission denied in /home/wwwroot/haitian/blog/wp-content/themes/prowerV3.1/functions.php on line 169
      回复

      额 因为老域名权重比较高 我的这个域名 文章一发布 立即就会被收录
      所以我就做了一个二级域名绑定到同一个空间 然后博客里稍微带一下这个二级域名 第二天就被收录了
      既然收录了 就要做好301转向了~


      • Warning: copy(/home/wwwroot/haitian/blog/avatar/b0ad080dbced9b0ec0cfb258b9bccc46.jpg): failed to open stream: Permission denied in /home/wwwroot/haitian/blog/wp-content/themes/prowerV3.1/functions.php on line 169
        回复

        前面的话能理解,“既然收录了 就要做好301转向了~”什么意思呢?


        • Warning: copy(/home/wwwroot/haitian/blog/avatar/3d58c5baea42043cdd0f012c22cfd774.jpg): failed to open stream: Permission denied in /home/wwwroot/haitian/blog/wp-content/themes/prowerV3.1/functions.php on line 169
          回复

          呵呵 我的意思是指 我那个二级域名已经被收录了 就要做301转向 将二级域名的权重转过去啊


  15. Warning: copy(/home/wwwroot/haitian/blog/avatar/6c32f4827ab7333b8b7eb500c51680a4.jpg): failed to open stream: Permission denied in /home/wwwroot/haitian/blog/wp-content/themes/prowerV3.1/functions.php on line 169
    回复

    Don’t you recognize that it is high time to receive the personal loans, which can make you dreams real.


  16. Warning: copy(/home/wwwroot/haitian/blog/avatar/b76173498c91b21d8d4dfdb48cfa81fc.jpg): failed to open stream: Permission denied in /home/wwwroot/haitian/blog/wp-content/themes/prowerV3.1/functions.php on line 169
    回复

    但是里面的文章页的url不会重定向到新域名上面。。


    • Warning: copy(/home/wwwroot/haitian/blog/avatar/3d58c5baea42043cdd0f012c22cfd774.jpg): failed to open stream: Permission denied in /home/wwwroot/haitian/blog/wp-content/themes/prowerV3.1/functions.php on line 169
      回复

      里面的 需要匹配

icon_wink.gif icon_neutral.gif icon_mad.gif icon_twisted.gif icon_smile.gif icon_eek.gif icon_sad.gif icon_rolleyes.gif icon_razz.gif icon_redface.gif icon_surprised.gif icon_mrgreen.gif icon_lol.gif icon_idea.gif icon_biggrin.gif icon_evil.gif icon_cry.gif icon_cool.gif icon_arrow.gif icon_confused.gif icon_question.gif icon_exclaim.gif 

« Wordpress定时发布功能其实是真的定时的 广告和网页同时异步加载功能 »