Selective mod_rewrite

Is it possible to do something like this with mod_rewrite:

For every URL of this form:

redirect to:

Basically, I just want to get rid of the non-folder ‘content’. The original site structure may have had a use for that folder, but now it’s just dead weight.


First make sure all contents are moved from contents/ to the root directory so the requests will work, and but the following .htaccess in your root directory:

RewriteEngine On
RewriteRule ^content/(.*)$ $1 [L,R=301]

Try with R=302 first, and if it works switch to 301.
302 is easier for debugging because it won’t be cached whereas 301 will.

RewriteEngine on
RewriteRule ^content/columns /columns/ [L,QSA]