HomeBlogHow to Redirect a domain to Joomla Subfolder?

How to Redirect a domain to Joomla Subfolder?

You can install your Joomla site in a subfolder rather than in a root folder. This will avoid all messy files in your root folder in your hosting drive. After you install in subfolder, you have to point your domain to sub folder.

To accomplish pointing your main domain  eg: ‘www.domain.com’ to go straight to joomla installation folder eg www.domain.com/joomla you need to add just the following code to your .htaccess file.

  • Go to folder public_html and there will be a .htaccess file there. make a copy (for backup) just in case.
  • In your  .htaccess find the line – RewriteEngine On
  • Under that add the code below. (replace domain with yourdomain and joomla with folder name for your joomla install)

RewriteCond %{HTTP_HOST} ^(www.)?domain.com$
RewriteCond %{REQUEST_URI} !^/joomla/
RewriteRule ^(.*)$ /joomla/$1
RewriteCond %{HTTP_HOST} ^(www.)?domain.com$
RewriteRule ^(/)?$ joomla/index.php [L]

Thats all you need ..now type in browser ‘www.domain.com’ and it will bring up your joomla website that is installed in subfolder /joomla

If you want multiple joomla installs on same server, with different joomla install folders and different domain names, you will need to use the cpanel. you can then set up in domain manager, set up as add on domain, and point to the folder with install.

If you are using Go Daddy for hosting then it makes it easier to do all the above. They have a domain forwarding with masking (to mask the sub-folders) feature built in to the admin section and a site redirecting feature

Disclosure: Mashtips is supported by its audience. As an Amazon Associate I earn from qualifying purchases.

1 COMMENT

  1. Hi Steve,
    Your snippet worked beautifully, however, it redirects only the home/index page. All my internal site links still point to the subdirectory url, which work fine, but show the subdirectory path in the url, including the home page after the first visit. Any idea how to achieve root-level redirect for all pages?

    Thanks for sharing.
    J

LEAVE A REPLY

Please enter your comment!
Please enter your name here

You May Like

More From Author