dpvomqeu396484 2012-07-24 12:01
浏览 45
已采纳

Mod在谷歌索引上重写404

my url is site.com/nl/url-rewrite/categorie-1
my mod rewrite rules are:

# Rewrite taxonomy URLs
#   Input:  LANG/url-rewrite/TERM
#   Output: url_rewrite.php?term=TERM
RewriteRule ^.{2}/url-rewrite/([A-Za-z0-9-]+)/?$ /url_rewrite.php?term=$1 [L]
#   Input:  LANG/url-rewrite
#   Output: url_rewrite.php
RewriteRule ^.{2}/url-rewrite/?$ /url_rewrite.php [L]

This works fine (not sure if the 2nd rule is the best way to approach this)

Now I'll get a link in google too site.com/nl/url-rewrite/categorie-1
'categorie-1' is the seo friendly alias of my category

If the title of my category changes too 'Categorie 2', my alias will be 'categorie-2' (auto alias)

this link in google site.com/nl/url-rewrite/categorie-1 will not work now
how can I solve this?
I used id's before, so my link would be site.com/nl/url-rewrite/1/categorie-1
But that doens't look so good, I don't want any id's in the url

  • 写回答

1条回答 默认 最新

  • dtrz17917 2012-07-24 17:22
    关注

    When you change your titles you need to 301 redirect the old URL to the new URL. You can either do this by internally tracking this when you change and having the url_rewrite.php script redirect the browser to site.com/nl/url-rewrite/categorie-2 when it sees someone trying to access categorie-1 (because it knows it's been changed), or you can manually add (above the 2 rules that you have) rules to do the 301 redirect manually:

    RedirectMatch 301 ^/?(.{2})/url-rewrite/categorie-1/?$ /$1/url-rewrite/categorie-2/
    

    The 301 tells google that all of the link information associated with the categorie-1 link should be transfered over to the new categorie-2 link. You'll just have to wait for search engines to get around to re-indexing the old links before that transfer happens so your pages will still show up as 404 until then.

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

报告相同问题?

悬赏问题

  • ¥20 access多表提取相同字段数据并合并
  • ¥20 基于MSP430f5529的MPU6050驱动,求出欧拉角
  • ¥20 Java-Oj-桌布的计算
  • ¥15 powerbuilder中的datawindow数据整合到新的DataWindow
  • ¥20 有人知道这种图怎么画吗?
  • ¥15 pyqt6如何引用qrc文件加载里面的的资源
  • ¥15 安卓JNI项目使用lua上的问题
  • ¥20 RL+GNN解决人员排班问题时梯度消失
  • ¥60 要数控稳压电源测试数据
  • ¥15 能帮我写下这个编程吗