Quick little problem with mod_rewrite (and Joomla if relevant)

Tag: apache , .htaccess , mod-rewrite , joomla Author: athletesss Date: 2011-04-02

For the sake of roll-back-ability I've pushed a newer version of a Joomla project into a sub-directory (sandbox) of the existing site.

(We moved them from 1.0 to 1.5)

To open up the newly uploaded version for public access, I figured I would just add an .htaccess file to the existing documents root, to skip over the files therein:

+- /www
    +- index.php     # old version
    +- ...           # files
    +- .htaccess     # htaccess file for redirects
    +- /sandbox
        +- index.php # new version
        +- ...       # files

My .htaccess file is as follows:

# .htaccess for sandbox redirect

RewriteEngine On
Options +FollowSymlinks

RewriteBase /
RewriteCond %{HTTP_HOST} mysite.com
RewriteCond %{REQUEST_URI} !sandbox/
RewriteRule ^(.*)$ sandbox/$1 [L]

It "works", and http://mysite.com now displays the contents of the sandbox directory; however links within the new version of the site include sandbox in their URLs, which still work of course, but now we have http://mysite.com/sandbox/foo/bar happenening, when we only want http://mysite.com/foo/bar

Any ideas?

Best Answer

Why not move the old site to /oldsite and move the new site to the root? If you've tested it and the site works, there is no need to mess around with all the redirecting.


Thought my way would prove to be simpler; however, I ended up re-organizing the file system.

Other Answer1

Try to set property $live_site in configuration.php in your joomla directory to "http://mysite.com"