Htaccess 301 redirect: previous folder redirect interferes with sub-folder redirect

I’ve got a problem when trying to re-direct urls to the equivalent content on to a new domain with a completely different folder structure. Here is what my .htaccess file looks like:

RewriteEngine On

# Add trailing Slash
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*[^/])$ /$1/ [L,R=301]

Redirect 301 /old-url-one/ http://www.newdomain.org/new-url-one/new-url-two
Redirect 301 /old-url-one/old-url-two/ http://www.newdomain.org/new-url-three/new-url-four

# Redirect everything else to the home page
RedirectMatch 301 ^ http://www.actionpf.org

The problem is with the second re-direct, where the destination of the first redirect seems to appear in the resulting URL.

Instead of going to http://www.newdomain.org/new-url-three/new-url-four, the second re-direct goes to
http://www.newdomain.org/new-url-one/new-url-twoold-url-two ––– I believe.

It seems that the first re-direction replaces paths in the second re-direction. What do I need to do differently?

Thank you!

Have you tried changing the order of the directives?

Depending on the actual values of old-url-two it might work.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.