|
Hide Joomla Subdirectory (Subfolder) |
Much thanks to
Geschrieben von Jörgi for this solution
Instead of installing Joomla in the web root (public_html), some like to put
the Joomla files in a subfolder for better housekeeping.
It's cleaner to see folders when you list publc_html and not all
the
Joomla files, especially if you have other server applications
installed such as blogs, forums, etc, or have created folders for
add-on or sub domains.
Installing Joomla in a subfolder is easy, but the appearance of the
subfolder in urls may be undesireable.
The example below has the Joomla files located
in a subfolder named joomla.
http://domain.com/joomla/index.php
will become
http://domain.com/index.php
mod_rewrite removes the subfolder from the url.
1. edit the file joomla/configuration.php.
In Joomla 1.5 var live_site is empty by default
Change
var live_site = '';
To
var live_site = 'http://domain.com';
In Joomla 1.0 you would be looking in the same file for $mosConfig_live_site =
2. Edit or create the file named .htaccess (invisible files begin with a period) in
your webroot (not the one in the joomla subdirectory) and change its content to:
#These first two lines might already be in the file - no need to repeat
Options +FollowSymlinks
RewriteEngine on
# remove "www" (this may be optional)
RewriteCond %{HTTP_HOST} ^www\.domain\.com$ [NC]
RewriteRule ^(.*)$ http://domain.com/$1 [R=301]
# Redirect to the Joomla root folder
RewriteCond %{HTTP_HOST} ^(www\.)?domain\.com$ [NC]
RewriteRule ^(index\.html)?$ http://domain.com/joomla/ [R=301]
# Only apply to URLs on this domain
RewriteCond %{HTTP_HOST} ^(www\.)?domain\.com$
# Only apply to URLs that aren't already under folder
RewriteCond %{REQUEST_URI} !^/joomla/
# Don't apply to URLs that go to existing files or folders
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite all those to insert /joomla
RewriteRule ^(.*)$ /joomla/$1 [L]
Replace domain.com with your domain and joomla with the name of the
subdirectory in which you have installed Joomla.
|