Hotels in Krakow - Loans - Debt Consolidation - Wester Union - Loans

PDA

View Full Version : htaccess redirect /test/anything.htm to /destination/ ?


Paz
Nov 15th 2007, 4:47 am
Hi Guys,

I've been tearing my hair out with this one all morning. I had a simple redirect from an old site to a new url.

redirect 301 /old/ http://www.example.com/new/

The problem is that I have some old files in the /old/ directory that are indexed eg
/old/index.php

After the above redirect the index.php is being appended to /new/index.php but this url doesn't exist and I'm getting dupe content issues.

Can anyone suggest a way to stop the old filename being appended to the redirected url ie the whole lot goes to /new/?

Here's code I've been working with;

RewriteEngine on
RedirectMatch (.*)/old/$ http://www.example.com/new/?
#RewriteCond %{REQUEST_URI} ^test\&(.*)$
#RewriteRule ^/(.*) http://www.example.com/destination/$1 [L,R=permanent]
#RewriteRule ^/(.*) http://www.example.com/destination/$1?%1 [L,R=permanent]
#RewriteRule /test/(.*) http://www.example.com/destination/ [R=301,L]
#redirect 301 /test/ http://www.example.com/destination

BTW I should point out that /new/ doesn't exist as such either - it's served up on the fly.

Cheers,
Paz.