doujiushi9007 2014-10-25 05:49
浏览 51
已采纳

永久重定向大量的url-s通过.htaccess或php

I just had to make general changes and had to move all url-s from one php page to another. This caused over 64000 missing url from Google. How can i change the old url like:

www.website.com/shop.php?product=nokia-phones-s5 to new url which is www.website.com/store.php?product=nokia-phones-s5

The only difference is shop.php in url becomes store.php What is better - php redirect and how or .htaccess redirect and how?

Thank you

  • 写回答

1条回答 默认 最新

  • donglu8549 2014-10-25 06:58
    关注

    You can use this code in your /phones/.htaccess file:

    RewriteEngine On
    RewriteBase /phones/
    
    RewriteRule ^shop\.php$ store.php [L,NC,NE,R=301]
    

    Query string is automatically forwarded to new target.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 PADS Logic 原理图
  • ¥15 PADS Logic 图标
  • ¥15 电脑和power bi环境都是英文如何将日期层次结构转换成英文
  • ¥20 气象站点数据求取中~
  • ¥15 如何获取APP内弹出的网址链接
  • ¥15 wifi 图标不见了 不知道怎么办 上不了网 变成小地球了
  • ¥50 STM32单片机传感器读取错误
  • ¥15 (关键词-阻抗匹配,HFSS,RFID标签天线)
  • ¥15 机器人轨迹规划相关问题
  • ¥15 word样式右侧翻页键消失