我最近改变了我的网站网址结构。但是,谷歌索引的网址正在给404找不到错误。现在,我寻求帮助并得到suggestion这样的内容。
RewriteRule ^([a-z|-]+)t(\d{3}-\d+\.html)$ /topic$2 [NC,R=301,L]
但是,为此,我遇到了firefox错误:“Firefox检测到服务器正在以永远无法完成的方式重定向此地址的请求。”
我之前的代码是这样的:
# FORUMS PAGES
###############
# FORUM INDEX REWRITERULE WOULD STAND HERE IF USED. "forum" REQUIRES TO BE SET AS FORUM INDEX
# RewriteRule ^forum\.html$ /index.php [QSA,L,NC]
# FORUM RewriteRule ^[a-z0-9_-]*-f([0-9]+)/?(page([0-9]+)\.html)?$ /viewforum.php?f=$1&start=$3 [QSA,L,NC]
# TOPIC WITH VIRTUAL FOLDER RewriteRule ^[a-z0-9_-]*-f([0-9]+)/topic([0-9]+)(-([0-9]+))?\.html$ /viewtopic.php?f=$1&t=$2&start=$4 [QSA,L,NC]
# GLOBAL ANNOUNCES WITH VIRTUAL FOLDER RewriteRule ^announces/topic([0-9]+)(-([0-9]+))?\.html$ /viewtopic.php?t=$1&start=$3 [QSA,L,NC]
# TOPIC WITHOUT FORUM ID & DELIM RewriteRule ^([a-z0-9_-]*)/?topic([0-9]+)(-([0-9]+))?\.html$ /viewtopic.php?forum_uri=$1&t=$2&start=$4 [QSA,L,NC]
# PROFILES ADVANCED RewriteRule ^[a-z0-9_-]*-u([0-9]+)\.html$ /memberlist.php?mode=viewprofile&u=$1 [QSA,L,NC]
# USER MESSAGES ADVANCED RewriteRule ^[a-z0-9_-]*-u([0-9]+)-(topics|posts)(-([0-9]+))?\.html$ /search.php?author_id=$1&sr=$2&start=$4 [QSA,L,NC]
# GROUPS ADVANCED RewriteRule ^[a-z0-9_-]*-g([0-9]+)(-([0-9]+))?\.html$ /memberlist.php?mode=group&g=$1&start=$3 [QSA,L,NC]
# POST RewriteRule ^post([0-9]+)\.html$ /viewtopic.php?p=$1 [QSA,L,NC]
# ACTIVE TOPICS RewriteRule ^active-topics(-([0-9]+))?\.html$ /search.php?search_id=active_topics&start=$2&sr=topics [QSA,L,NC]
# UNANSWERED TOPICS RewriteRule ^unanswered(-([0-9]+))?\.html$ /search.php?search_id=unanswered&start=$2&sr=topics [QSA,L,NC]
# NEW POSTS RewriteRule ^newposts(-([0-9]+))?\.html$ /search.php?search_id=newposts&start=$2&sr=topics [QSA,L,NC]
# THE TEAM RewriteRule ^the-team\.html$ /memberlist.php?mode=leaders [QSA,L,NC]
#####################################################
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-z0-9_-]+)/?(page([0-9]+)\.html)?$ /viewforum.php?forum_uri=$1&start=$3 [QSA,L,NC]
我需要的是:重定向这样的网址。
来自: www.mydomain.com/topic-titles-here-t273.html
致: www.mydomain.com/topic273.html
来自: www.mydomain.com/topic-titles-here-t273-15.html
致: www.mydomain.com/topic273-15.html
来自: www.mydomain.com/51-topic-titles-here-t273-15.html(观察,标题中的数字为51)
致: www.mydomain.com/topic273-15.html
请指导我。
答案 0 :(得分:0)
试试这个:
RewriteCond %{REQUEST_URI} !^/topic[0-9-]+\.html$
RewriteRule ^([a-z|-]+)t(\d{3}-\d+\.html)$ /topic$2 [NC,R=301,L]
这应该排除您的新网址被重写。