Forum Moderators: phranque

Message Too Old, No Replies

htaccess redirect 2nd part

I want to redirect a page when a 2nd part of the url contains 'feed'

         

yannickb

12:53 pm on Nov 7, 2010 (gmt 0)

10+ Year Member



Hi everyone,

At the moment i'm busy copying content from a Wordpress-based website into a Joomla-based website, and i'm stuck with a small problem:

Each wordpress article has a /feed/ and /trackback/ at the second part of the url(Like domain.com/article-bla/trackback).
Now i want to make a htaccess redirect which makes it possible to redirect a user when going towards /trackback/ at the joomla site(Which doesn't exist).

When a visitor goes to /article/trackback/, i want him to be redirected towards /article/, i tried this:
RewriteRule ^(.*)/trackback/ [site.com...] [R=301,L]

But this didn't work, does anyone know here how i could make this redirect?

Regards,
Yannick

g1smd

1:36 pm on Nov 7, 2010 (gmt 0)

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



Place this early in your list of redirects, before any domain canonicalisation code:

# External Redirect from /<anything>/trackback/ (with trailing slash
# optional on original request) to www.example.com/<anything>/
RewriteRule ^(([^/]+/)+)trackback/?$ http://www.example.com/$1/ [R=301,L]


There must NOT be any internal rewrites BEFORE this code. All rewrites must be listed after the redirects.

yannickb

2:53 pm on Nov 7, 2010 (gmt 0)

10+ Year Member



Thanks a lot!