doudongfu8006 2014-08-04 09:10
浏览 63
已采纳

在Symfony 2中使用URL复制进行管理

I have a real estate website, coded in Symfony 2.

Every morning, we automatically import properties from a real estate software, and we update the data base.

The URL is rewritten with the title of the property and the ID, like :

.../%title%-%ID% 

Sometimes, the real estate agent change the title of the property, so the URL changes as well.

It's creating a duplicate content in Google, because 2 URL now exists for the same page.

I want to fix it, to automatically add a redirect 301 from the old URL to the new one.

How can I do that in Symfony 2?

Thanks for your help !

Mathieu

  • 写回答

2条回答 默认 最新

  • dsfs5420 2014-08-13 19:06
    关注

    thank you for all your comments. I'm working with Mat Bios and you help us to find the solution.

    We find a way to detect old url and then to make a redirect 301 in the controller.

    return $this->redirect($currentUrl, 301);

    Thank you

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 高价求中通快递查询接口
  • ¥15 解决一个加好友限制问题 或者有好的方案
  • ¥15 关于#java#的问题,请各位专家解答!
  • ¥15 急matlab编程仿真二阶震荡系统
  • ¥20 TEC-9的数据通路实验
  • ¥15 ue5 .3之前好好的现在只要是激活关卡就会崩溃
  • ¥50 MATLAB实现圆柱体容器内球形颗粒堆积
  • ¥15 python如何将动态的多个子列表,拼接后进行集合的交集
  • ¥20 vitis-ai量化基于pytorch框架下的yolov5模型
  • ¥15 如何实现H5在QQ平台上的二次分享卡片效果?