Selective mod_rewrite

Is it possible to do something like this with mod_rewrite:

For every URL of this form:

http://www.xyz.com/content/columns/

redirect to:

http://www.xyz.com/columns/

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.

Thanks!

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]