0

I recently changed my site url structure. But, Google indexed urls are giving 404 not found errors. Now, I asked for help and got suggestion like this.

  RewriteRule ^([a-z|-]+)t(\d{3}-\d+\.html)$ /topic$2 [NC,R=301,L]

But, for that, I'm getting firefox error: "Firefox has detected that the server is redirecting the request for this address in a way that will never complete."

My previous code is like this:

# 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]

What I need is this: redirecting urls like this.

From : www.mydomain.com/topic-titles-here-t273.html

To : www.mydomain.com/topic273.html

From : www.mydomain.com/topic-titles-here-t273-15.html

To : www.mydomain.com/topic273-15.html

From : www.mydomain.com/51-topic-titles-here-t273-15.html (observe, numbers like 51 in titles)

To : www.mydomain.com/topic273-15.html

Please guide me.

Community
  • 1
  • 1
user625118
  • 29
  • 1
  • 6
  • Its case of infinite redirect. What are the other rules of redirect?. You can check your access logs to which address its redirecting again and again and update the question with that info. – Zimbabao Feb 20 '11 at 17:00

1 Answers1

0

Try this:

RewriteCond %{REQUEST_URI} !^/topic[0-9-]+\.html$
RewriteRule ^([a-z|-]+)t(\d{3}-\d+\.html)$ /topic$2 [NC,R=301,L]

That should exclude your new URLs from being rewritten.

Dave Child
  • 7,573
  • 2
  • 25
  • 37