Si la procédure est parfaitement décrite pour WordPress, elle ne semble pas toujours passionner la communauté Joomla. Mais une solution existe.

Ci-après, un exemple de fichier .htaccess inspiré des ces articles:

Exemple

Prenons le cas d’une installation Joomla contenue dans un sous-dossier tq http://www.yoursite.com/subdir.

Le fichier .htaccess, installé à la racine du domaine, contiendra:

Options +FollowSymLinks
RewriteEngine On
RewriteBase /
# This section must come first!
# Add trailing slash if path does not contain a period or end with a slash
RewriteCond %{REQUEST_URI} !(.|/$)
RewriteRule (.*) http://www.yoursite.com/$1/ [R=301,L]
#Change http://yoursite.com to http://www.yoursite.com (Optional)
RewriteCond %{HTTP_HOST} ^yoursite.com$
RewriteRule ^/?(.*)$ http://www.yoursite.com/$1 [R=301,L]
# Exclude any subdirectories in the site root that should NOT be re-directed to joomla
# At least include the joomla directory here. The other commented lines are examples and will need customising
# It is probably best not to use directories in your site root that also exist in joomla e.g. images
RewriteCond %{REQUEST_URI} !^/folder1
RewriteCond %{REQUEST_URI} !^/folder2
RewriteCond %{REQUEST_URI} !^/(folder3|folder4|folder5|folder6)
#Rewrites http://www.yoursite.com/subdir to http://www.yoursite.com/
RewriteCond %{REQUEST_URI} !^/subdir
RewriteRule ^(.*)$ subdir/$1 [L]

Il ne reste plus qu’à renseigner la variable du fichier configuration:

var $live_site = ‘http://www.yoursite.com/’;

Modifié le