Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I just did a 301 and the domain and some pages which have a mirror file path are fine.

But I have one directory which is not going to be part of the new site and I don't know how to redirect the old files that were there.

I need something like this: oldDomain/oldDir/file.php

and I need to make it redirect to

newDomain/differentDir/file.php

Is that possible? What is the 301 redirect rule for that?

update

I just added this rule as suggested by @Itai and it didn't work

redirectMatch permanent ^/outdoors/trees/tanoak.php$ http://www.comehike.com/outdoors/trees/129/Tanoak

any idea why?

share|improve this question
    
Are you missing a file at the end of your rule? If that is a directory, use a / at the end. If not, try it as your first rule (in case others have precedence). If it still does not work, check your Apache config to make that .htaccess use is enabled, your .htaccess is readable (permissions) by Apache and it is either in the right path or in its parent path. –  Itai Mar 7 '11 at 1:01
add comment

migrated from webapps.stackexchange.com Mar 3 '11 at 15:55

This question came from our site for power users of web applications.

1 Answer

For each page, you need a redirect like the following in your .htaccess:

redirectMatch permanent ^/oldDir/file.php$ http://www.newdomain.com/differentDir/file.php

Notice you do not use the 'oldDomain', this is implied because the .htaccess you modify has to be on the old domain's server.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.