Htaccess - Help redirecting to new URLs

I’m trying to do a URL rewrite and redirect

Currently I have the following URLs:

In order to rewrite them I used the following code for the .htaccess file:

Options +FollowSymlinks
RewriteEngine on
RewriteRule ^cities/([^/\.]+).html?$ cities/index.php?id=$1[L]
RewriteRule ^cities/([^/\.]+)/([^/\.]+).html?$ cities/index.php?var=$1&id=$2 [L]

That has worked fine for rewriting. However, I now want to 301 redirect the old URLs to the newly rewritten URLs so that there won’t be duplicate content on my site.

In other words, if a user types in:

I would like them to be automatically 301 redirected to:
http://parttimejobsin.us/cities/1.html

Additionally, if a user types in:

I would like them to be automatically 301 redirected to:
http://parttimejobsin.us/cities/Accounting/1.html

Is this possible to do? Any help would be greatly appreciated!

You sure can. Take a look at the section “Redirect TO New Format” of the article on mod_rewrite written by SitePoint member dklynn:

Thanks. I’ll try that.