I am in a unique situation where I have multiple instances of Joomla setup under my primary domain in different subdirectories.

For example:

mydomain.com = Joomla instance
mydomain.com/subdirectory1 = Another Joomla instance
mydomain.com/subdirectory2 = Another Joomla instance

On the main Joomla instance I was able to forward my non-www pages to www using the htaccess file and this code:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^mydomain.com [NC]
RewriteRule (.*) http://www.mydomain.com/$1 [L,R=301]

I want to also forward non-www pages to www pages on all of the subdirectories.

What would be the best way to achieve this? Since each subdirectory has it's own Joomla instance, is there something I can just add to each of the htaccess files?

Thank you so much for your help!


You need to add the following line into each .htaccess in subfolders if you want to have rewrite rules from parent .htaccess to be executed as well:

RewriteOptions inherit

This forces the current configuration to inherit the configuration of the parent. In per-virtual-server context, this means that the maps, conditions and rules of the main server are inherited. In per-directory context this means that conditions and rules of the parent directory's .htaccess configuration are inherited.

Rules inherited from the parent scope are applied after rules specified in the child scope.


  • Hi Max, Thanks for your reply. Adding that to the .htaccess in each subfolder actually forwards the non-www pages to www.mydomain.com and removes the subfolder from the URL. Mar 4 '16 at 17:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.