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.


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]


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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy