Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Need help with an 301 htaccess redirect cond and rule doing the following for all the files in these paths:

www.name.com/wordA/wordB/* to www.name.com/new_word/wordA/wordB/*

we are basically adding "new_word" to the new url string.

share|improve this question

Put this in your .htaccess:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    RewriteRule ^wordA/wordB(.*)$ http://www.name.com/new_word/wordA/wordB$1 [L,R=301]

</IfModule>
share|improve this answer

You don't necessarily need to use mod_rewrite to do this. This can also been done with the Redirect statement provided by mod_alias. It will also append the additional path information to the new URL.

Redirect 301 /wordA/wordB http://www.name.com/new_word/wordA/wordB
share|improve this answer

Your Answer

 
discard

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