I need to use .htaccess file to replace a word in a URL; something like this:
Example URL:
http://example.com/oldword/test-page.html
Redirect to:
http://example.com/newword/test-page.html
How can I use mod_rewrite to redirect every URL containing /oldword/ to the same URL after replacing that word?
This should do it for you:
Edit: It might not work exactly depending on your RewriteBase settings, but it’ll be close.
Second Edit: If you need to have a 301 Moved Permanently header associated with the old URLs, you can do something like this as well: