Redirect Subdomain to Subdomain/subdirectory

Hi, we have a site running on a subdomain currently (subdomain.domain.org).

We would like to ‘redirect’ this site to a subdirectory of this subdomain (subdomain.domain.org/subdirectory) so we can redevelop the root level site while keeping the existing site functioning in this subdirectory (where it may exist permanently eventually).

The site is already using an .htaccess file to rewrite URLs into friendlier SEF URLs (it’s a Joomla site). So the main root file (index.php) is already re-written as ‘http://subdomain.domain.org/’. And any sub-pages are re-written as ‘http://subdomain.domain.org/sample-page’ instead of ‘http://subdomain.domain.org/index.php?option=com_content&view=article&id=19&Itemid=27’.

So would there be a way to redirect all of the existing pages for the public, but still give us a way to manually view pages in the root as we test the new redeveloped site?

Thanks! I’m a bit new to htaccess redirects.

Jethro,

IMHO, the best way to do this is to set the DocumentRoot of the subdomain to the subdirectory. cPanel does this by default so, if you’ve already established the subdomain as being co-located with the main domain, you may need your sysadmin to change the VirtualHost file for you. Anything else is a waste of resources.

Regards,

DK