Every now and then I must fuddle around with mod_rewrite in other words Apache's redirect. Now I've got a simple task, that drives me nuts, cause I can not have it working:

Exactly what was under /journal/(.*) has become under /blog/(.*).

This is exactly what I've now:

RewriteEngine on
RewriteBase /
RewriteRule ^/journal/([^/]+)$ /blog/$1

Whether it matters: this can be a drupal installation.

  • Drupal has existing rewrite rules in .htaccess. Should you place your rules towards the top of the file, Drupal's rules may override them.
  • I do not think you would like the beginning / inside your rule.
  • If you are expecting the rule to redirect people that make use of the old /blog/ URL, you are mistaken. If that is what you are attempting to do, you will need to execute a redirection, such as this:


RewriteEngine on
RewriteBase /
RewriteRule ^journal/(.+)$ http://example.com/blog/$1 [R=301,L]

as your rewrite is made of / I believe you are able to omit the / before journal. so try

RewriteRule ^journal/([^/]+)$ /blog/$1

Also for those who have every other rules happening you are able to append [L] towards the finish from the statement to make certain not one other rewrites happen.