Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

2 Answers 2

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]

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


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