Moving Joomla site to a subfolder

Before rebuilding this website, I wanted to make sure I was able to keep the old site in a subfolder to help keep my search ranking and not break any external links to my site. This is clearly a job for modRewrite so I had a look around and goolged things like “Joomla to subdirectory” and the like. Funny enough I couldn’t find any posts about it and no-one had posted the required .htaccess entries to make it happen. As I’d never used SEF urls with my Joomla site and I wasn’t going to use Joomla for the new website, it was easy to find a pattern that all my urls would match. I could simply send anything that contained the string “option=com” to my “archived” subfolder.

Here’s the entries I added to the .htaccess in the root of my website:
[code]
# Make sure this module is turned on
RewriteEngine on

# Match any Joomla Urls
RewriteCond %{QUERY_STRING} ^option=com(.*)$

#Only forward Get and Head requests to the archived site
RewriteCond %{THE_REQUEST} ^(GET|HEAD)

# Don’t match urls that already contain the archived subfolder
RewriteCond %{REQUEST_URI} !^/archived/$

# Send a 301(Permanent Move) to the archived folder
# and don’t process any more rules(L)
RewriteRule ^index.php$ /archived/index.php [L,R=301]

[/code]

Follow-up:
As it turns out you can’t set the database permissions for specific tables when running in a typical shared LAMP environment. I was hoping for SELECT only and INSERT on some Joomla session tables. I noticed that I was still getting some new spam user registrations on the old site so I’ve disabled POST requests with the following entries added to the .htaccess in the /archive folder of the old Joomla site:
[code]
# Make sure this module is turned on
RewriteEngine on

# Disallow POST requests to the archived site by sending a 404 error
RewriteCond %{THE_REQUEST} !^(GET|HEAD)
RewriteRule ^ / [R=404]

[/code]