This is an excellent topic for discussion. We're having a similar discussion around a problem on the Joomla forum at
forum.joomla.org/viewtopic.php?f=710&t=968911 which, I believe, is related to the way that people organise the files on their webservers and there are a few particular issues relating to how "best" to organise the files on shared webhosts.
Terry wrote:
Back when I first started playing with Joomla I didn't like the way the Self installers that come with the hosting account would put Joomla in the accounts public_html directory. I wanted to be able to put Joomla in its own directory, ie./public_html/site1, which was easy enough once I started downloading and installing Joomla for myself.
This is one of many reasons why people should avoid using "self installers" or "quickie" installs because, even though they take a few less mouse-clicks that using the standard approach
which, by the way, takes less than 10 minutes, they generally cause more maintenance headaches in the long run.
Terry wrote:
Is there another way to handle having Joomla in a sub-directory that doesn't use Livesite= in the config for a site using the hosting accounts root domain?
As a general rule, a properly configured J! website should leave the configuration.php file with this entry:
So don't change it.
Terry wrote:
However having a site in its own directory left me with a URL with a directory name,
www.mydomain.com.au/site1/home so I made some .htaccess to removed the directory name from URL.
This is the crifical question. For those [few] people who only want one website, it's a case of "who cares?" But who only wants
one website? If you're running your website for business (and every website is a "business" of one kind or another even if it's not for profit or just as a hobby), you should have a test site on standby for experimentation.
When people obtain a shared hosting account, there's normally a domain associated with it. This is called the
primary domain. URLs accessing the primary domain will look at the "root folder" (i.e.
/public_html) and expect to find something there to execute. So, the idea is to "containerise" your websites to use separate sub-folders of the root. In other words, let's say the primary [domain] site is called
www.site1.com.au and its files are placed in
/public_html/site1. Following with me so far?
The trick is to redirect the URLs that—by default—expect to find the site in
/public_html and point the HTTP requests relating to the real site at
/public_html/site1 (i.e the sub-folder). The solution is to create a .htaccess file in the root folder with the following statements:
# .htaccess main domain to subdirectory redirect
# Copy and paste the following code into the .htaccess file
# in the public_html folder of your hosting account
# make the changes to the file according to the instructions.
# Do not change the line below.
RewriteEngine on
# Change site1.com.au to be your main domain.
# Change 'site1' to be the directory you will use for your main domain
RewriteCond %{REQUEST_URI} !^/site1/
# Don't change the next two lines.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
That's it. That's all there is to it!