I want to use a subdirectory in public_html as the root folder. Is that possible?
Say, for example, you have installed Joomla in the folder public_html/joomla (to the outside world that is then http://www.uwdomein.xx/jooma).
But you want people who type www.uwdomein.xx to end up in the joomla folder.
You can do this by creating a file called .htaccess in the public_html folder. To the outside world it will then look as if there is no subdirectory: visitors only see www.uwdomein.xx
Put the following in that file:
Options +FollowSymlinks
RewriteEngine On
RewriteBase /
RewriteBase /
# add a slash if the path contains no dot and does not end with a slash
RewriteCond %{REQUEST_URI} !(\.|/$)
RewriteRule (.*) http://www.voorbeeld.XX/$1/ [R=301,L]
#Change http://voorbeeld.xx to http://www.voorbeeld.xx
RewriteCond %{HTTP_HOST} ^voorbeeld.xx$
RewriteRule ^/?(.*)$ http://www.voorbeeld.xx/$1 [R=301,L]
## Now perform the subdir to rootdir rewrite
RewriteCond %{REQUEST_URI} !^/joomla
RewriteRule ^(.*)$ joomla/$1 [L]
This is step 1, which you carry out in the .htaccess file in the public_html folder.
But there also needs to be a .htaccess file in the joomla folder.
Rename Joomla's default htaccess.txt to .htaccess
In that file, change:
"#RewriteBase /" to "RewriteBase /joomla"
Finally, edit configuration.php:
$live_site = 'http://www.voorbeeld.xx'
Needless to say, installing Joomla directly in the public_html folder instead of a subdirectory is simpler and less error-prone.
Keywords: joomla subdirectory subfolder redirect htaccess forward forwarding
