Forum Moderators: phranque

Message Too Old, No Replies

redirect folder/26 to /26.html

I messed up my wordpress now google has weird url's

         

ogletree

7:18 am on Jul 17, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I had www.domain.com/26.html as my URL's for the longest time. I did something one day to my wordpress that changed them to:

www.domain.com/archives/26

I got it back to what it was. I need something to rewrite or redirect this to the right place becasue google got in there and indexed them quite fast.

I can get it to redirect using

Redirect permanent /archives [domain.com...]

All this does is make it www.domain.com/26

How do I add .html to this?

ogletree

4:08 pm on Jul 17, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Well I got the code:

RewriteRule ^archives/(.*)/ /$1.html [R]
RewriteRule ^archives/(.*) /$1.html [R]

from a friend. It works fine on a blank htaccess file but not my convoluted wordpress one.

jdMorgan

5:29 pm on Jul 17, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



In least-to-most-specific order, one of these might work better:

RewriteRule ^archives/([0-9]{2})/?$ http://www.example.com/$1.html [R=301,L]
-or-
RewriteRule ^archives/([0-9]/?$ http://www.example.com/$1.html [R=301,L]
-or-
RewriteRule ^archives/(26)/?$ http://www.example.com/$1.html [R=301,L]

However, if you've got another redirect in your .htaccess that countermands this redirect (resulting in a redirection loop), then we'll need to take it a step further.

Jim