Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Giving Joomla Its Own Directory
12-19-2014, 10:12 AM,
#1
Giving Joomla Its Own Directory
Sometimes it makes sense to have Joomla power our website's root (ex. http://www.example.com) but we don't want all of the Joomla files and directories cluttering up the root (public_html) folder. It is possible to install Joomla into a subdirectory and still have our website served from the root domain.

Using a pre-existing subdirectory install
If you already have Joomla installed in its own folder (ex. http://www.example.com/joomla), then the steps are as follows:

1. Edit your .htaccess in your webroot directory on the server (ex. /public_html/.htaccess) and insert this code:

Code:
# .htaccess root domain to Joomla subdirectory redirect
RewriteEngine on
# Change all three instances of 'joomla' if you are using a different directory for your Joomla installation
RewriteCond %{THE_REQUEST} joomla/
# Change example.com to your domain
RewriteRule ^subdir/(.*) http://example.com/$1 [R=301,L]
RewriteCond %{REQUEST_URI} ! joomla/
RewriteRule ^(.*)$ /joomla/$1 [L]

find RewriteBase / and replace with:

Code:
RewriteBase /joomla/

2. Important: by following the steps above, your site will work from the /joomla subdirectory and will be served from the root domain however, after clicking any URL, the /joomla subdirectory will appear in the path. To fix that, simply edit the configuration.php file and give the $live_site variable a value.

The $live_site variable rarely needs to be given a value, possibly it is empty but if it was given a value during installation then edit that path:

Code:
var $live_site = 'http://www.example.com';

3. (Optional) Search Engine Friendly URLs with Use URL rewriting:
.htaccess in your /joomla directory (ex. /public_html/joomla/.htaccess) or rename htaccess.txt to .htaccess - if this causes errors, edit and comment Options +FollowSymLinks:

Code:
## Can be commented out if causes errors, see notes above.
#Options +FollowSymLinks



Using a pre-existing root directory install

The steps are pretty much the same as described above, you just need to move your site to a subfolder. To do so, follow these instructions: Moving the Joomla site among directories/sub-directories

That's all Wink you will find some more info and comments here and here.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)