Skip to main content

Domainredirect

  • Important : Domainredirect n'est pas encore disponible pour Joomla! 4, ce sera bientôt le cas.
    Merci pour votre patience.

    domainredirect visuel

    Compatible Joomla 2.5 Compatible Joomla 3.0 Compatible Joomla 3.5

    Domain redirect est un petit plugin pour Joomla 2.x et 3.x qui permet de rediriger toutes les requètes effectuées sur un site avec un domaine vers la page équivalente sur un autre domaine. Par exemple, si mon site utilisait le domaine www.monpremierdomaine.com et que je change pour utiliser ensuite www.autredomaine.be, il se pourrait que des utilisateurs accèdent encore au site avec l'ancien domaine. Pour les rediriger avec élégance vers le nouveau domaine, il faut envoyer une entête 301 (Moved permanently) et renvoyer au nouveau domaine sur la page équivalente (et pas à la racine du site). Ceci implique normalement d'écrire des règles de redirections au début du fichier .htaccess (ou équivalent) de votre site. L'exemple ci-dessous vous montre les règles à utiliser : 

    #### si vous utilisez Joomla!, ces deux directives
    #### sont en principe déjà dans le fichier .htaccess 
    RewriteEngine On
    RewriteBase /

    #### Ci-dessous, le domaine vers le quel il faut renvoyer est www.mondomaine.com
    Rewritecond %{HTTP_HOST} !^www\.mondomaine\.com
    RewriteRule ^(.*)$ http://www.mondomaine.com/$1 [R=301,L]

    Si vous ne pouvez pas (par exemple parce que votre hébergement n'est pas configurable de cette manière) ou que vous ne souhaitez pas (par exemple parce que vous ne vous sentez pas assez qualifié) utiliser ces règles, vous pouvez utiliser ce plugin pour Joomla (compatible Joomla 2.x et 3.x) qui fait exactement la même chose mais qui est paramétrable avec une interface dans l'admin de votre site. 

    domainredirect est disponible sur le Joomla Extensions Directory : 
    http://extensions.joomla.org/extensions/extension/site-management/url-redirection/domain-redirect
    Il est compatible avec Joomla! 2.5.x, 3.x et 4 alpha

    Instructions

    • Téléchargez l'archive ci-dessous et installez-la dans le gestionnaire d'extensions de Joomla! OU utilisez l'onglet "Installer à partir du web" pour localiser et installer le plugin ; 
    • Après installation, allez dans la gestion des plug-ins (Extensions > Plug-ins), trouvez Domainredirect et éditez le plug-in ; 
    • Réglez le statut sur Activé
    • Réglez le Domaine cible. ATTENTION!!! vous ne DEVEZ PAS indiquer le préfixe "http://". Indiquez UNIQUEMENT le domaine (par exemple www.mondomaine.com) et rien d'autre ; 
    • Si vous souhaitez renvoyer vers une landing page plutôt que sur la page équivalente, vous pouvez renseigner le paramètre Page d'accueil. Sinon, laissez vide (défaut) ;
    • Le paramètre Interdire la redirection pour /administrator devrait TOUJOURS être laissé sur OUI (réglage par défaut). Si vous le passez à NON, la redirection affectera la partie publique et l'administration du site. Cela signifie que si vous avez fait une erreur de configuration, l'administration deviendra inaccessible et il sera difficile de désactiver le plugin. 

    FAQ 

    • J'ai activé le plugin et maintenant plus rien ne marche !
      La cause la plus courante est l'absence de fichier .htaccess pour Joomla. Avez-vous bien pensé à renommer correctement le fichier htaccess.txt en .htaccess à la racine du site ? Si ce n'est pas le cas, il faut le faire, sinon la redirection risque de ne pas fonctionner. Sinon, il y a une erreur de paramétrage, voyez ci-dessous comment désactiver le plugin le temps de corriger.
    • Je n'ai plus accès à la partie administration du site, je ne parviens pas à désactiver le plugin ! 
      On vous avait bien dit de laisser le paramètre "Interdire la redirection pour /administrator" sur OUI. Maintenant vous allez devoir désactiver le plugin à la main. Deux méthodes pour cela : 
      • Accédez à votre site en FTP, allez dans le répertoire /plugins/system/domainredirect et effacez les trois fichiers qui s'y trouvent ; 
      • Accédez à votre base de données via phpmyadmin (ou équivalent), dans la table #__extensions, trouvez la ligne où name est "plg_system_domainredirect", modifiez-là et mettez le champ enabled à la valeur 0 (zéro). 
    • La redirection ne fonctionne pas, le paramètre "domaine cible" est préfixé avec des caractères étranges.
      Le paramètre "domaine cible" ne DOIT PAS contenir le préfixe http:// -- si vous l'ajoutez, il sera transformé avec des caractères étranges. Retournez dans l'administration et indiquez seulement votre nom de domaine (éventuellement avec le sous-domaine, par exemple "www.") dans le paramètre. 
    • Puis-je rediriger d'une page de mon ancien site vers une page différente dans le nouveau site?
      Oui. Utilisez le paramètre Page d'accueil du plugin. L'appel de n'importe quelle page sur l'ancien domaine redirigera vers cette page du domaine cible.
    • Puis-je rediriger vers un domaine différent/une page différente selon que l'URL source est un domaine/une page différente?
      Non. peut seulement remplacer un domaine par un autre dans l'URL source.

    Téléchargement 

    Version courante

    https://f001.backblazeb2.com/file/extupdates/domainredirect-112.zip (version 1.1.2 – 7 Ko) 
    Compatible with Joomla! 3 Compatible with Joomla! 4 alpha
    Compatible Joomla 2.5

    Archives

    Attention ! Les versions ci-dessous sont archivées, nous vous déconseillons donc leur utilisation.
    https://f001.backblazeb2.com/file/extupdates/domainredirect-111.zip (version 1.1.1 – 7 Ko) 
    https://f001.backblazeb2.com/file/extupdates/domainredirect-110.zip (version 1.1.0 – 7 Ko)
    https://f001.backblazeb2.com/file/extupdates/domainredirect-102.zip (version 1.0.2 – 7 Ko) 
    https://f001.backblazeb2.com/file/extupdates/domainredirect-101.zip (version 1.0.1 – 7 Ko)

    Changelog

    https://www.petitpoisson.be/public/domainredirect_changelog.txt

    1.1.2

    - modified the redirect method to accomodate JApplication being deprecated ; I now use the correct CMSapplication->redirect() method. This means that previous versions could have been sending http 303 (see other code) headers instead of http 301 (permanently redirected)...

    1.1.1

    - removed the DEBUG flag that forced the plugin to display messages instead of redirecting (stupid me!)
    - changed the update server address because of incompatibilities with my hoster

    1.1.0

    - More graceful redirect using JApplication->redirect()
    - Now correctly getting URL using Joomla's JURI
    - Changed the language files again again (always more careful!)
    - Domain name can now be up to 255 characters long
    - Added the ability to define a landing page instead of redirecting to the same page

    1.0.2

    - Changed the language files again (minor additions)
    - Changed the label on the parameters page to state that you REALLY CANNOT put http:// there !
    - Added a control in the plugin code that does not redirect (and triggers an error message) if http: is spotted in the target domain
    - Added update server

    1.0.1

    Bugfix with extended language files


    1.0.0

    Initial release

  • Important : Domainredirect is not yet available for Joomla! 4, it will soon be.
    Thanks for your patience.

    domainredirect visuel

    Compatible Joomla 2.5 Compatible Joomla 3.0 Compatible Joomla 3.5

    Domain redirect is a small plugin for Joomla 2.x et 3.x that allows to redirect any request made on a website with a certain domain name to the equivalent page on another domain. For example, if my site did use the domain www.myfirstdomain.com and I did change change it and I now use www.otherdomain.be, there might still be users trying to access the website using the old domain. In order to redirect them gracefully to the new domain, you need to send an HTTP 301 header (Moved permanently) and the redirect to the new domain on the same page (not to the website root). This normally requires that you write rewrite rules at the top of the .htaccess (or equivalent) file of your site. Below, you'll find an example of rules you'd have to write : 

    #### if tou are using Joomla!, these two directives
    #### are already in the .htaccess file
    RewriteEngine On
    RewriteBase /

    #### Below, the domain to which you redirect is www.mondomaine.com
    Rewritecond %{HTTP_HOST} !^www\.mydomain\.com
    RewriteRule ^(.*)$ http://www.mydomain.com/$1 [R=301,L]

    If you cannot (e.g. because your hosting does not allow using .htaccess) or won't (e.g. because you don't feel qualified) write there rewrite rules, you can use this Joomla plugin (compatible with Joomla 2.x and 3.x) which does exactly the wame but can be administered from the admin part of your website. 

    domainredirect is available on the Joomla Extensions Directory : 
    http://extensions.joomla.org/extensions/extension/site-management/url-redirection/domain-redirect

    Instructions

    • Download the archive below and install it, or use the web install tab ; 
    • After installing, go to the plugins page (Extensions > Plugins), find domainredirect and modify ; 
    • Set status to activated ;
    • Set target domain. ATTENTION!!! you MUST NEVER write the "http://" prefix. Please set ONLY the DOMAIN (e.g. www.mydomain.com) and nothing else ; 
    • If you wish to redirect to a landing page rather than the current page, you can set the Landing page parameter. Otherwise leave it empty (default) ;
    • The Disable redirection for /administrator parameter should ALWAYS be left to YES (default setting). If you set it to NO, the redirection will affect the admin part of your website. This means if config is not right somehow, you'll loose access to the website admin and it will be difficult to correct settings or deactivate the plugin.  

    FAQ

    • I published the plugin and now nothing works anymore!
      The most probable cause is that there's no .htaccess file for Joomla. Did you think of renaming the htaccess.txt file to .htaccess at the site root ? If not, you should do it now.  Else, redirection might now work. There can also be another error, in which case see below how to manually deactivate the plugin.
    • I can't access the administration of my site, I can't deactivate the plugin ! 
      I did tell you to leave the "Disable redirection for /administrator" to YES. Now you'll have to manually deactivate the plugin. Two methods : 
      • FTP to your website, go to the /plugins/system/domainredirect directory and delete everything in there ; 
      • Access your DB via phpmyadmin (or equivalent), in the #__extensions table, find the line where name is equal to "plg_system_domainredirect", edit it and set the enabled field to 0 (zero). 
    • Redirection does not work, the "target domain" has strage characters before it.
      The "target domain" parameter MUST NOT contain the http:// prefix -- if you do indicate it, it can be transformed to strange characters sometimes. Go back to the plugin administration and please set the target domain correctly (without http:// and with subdomains, e.g. www). 
    • Can I redirect from a page from my old site to a different page in my new site?
      Yes. Use the Landing page parameter of the plugin. Now calling any page with the old domaine will redirect to the landing page in the target domain.
    • Can I redirect to a different domain/page if the source page/domain is différent?
      No. Domainredirect can only subsititute domains in the source URL. 

    Download

    Current version

    https://f001.backblazeb2.com/file/extupdates/domainredirect-112.zip (version 1.1.2 – 7 Ko) 
    Compatible with Joomla! 3 Compatible with Joomla! 4 alpha
    Compatible Joomla 2.5

    Archive

    Careful ! Versions below are archived for a reason. We don't recommend you use them.
    https://f001.backblazeb2.com/file/extupdates/domainredirect-111.zip (version 1.1.1 – 7 Ko) 
    https://f001.backblazeb2.com/file/extupdates/domainredirect-110.zip (version 1.1.0 – 7 Ko)
    https://f001.backblazeb2.com/file/extupdates/domainredirect-102.zip (version 1.0.2 – 7 Ko) 
    https://f001.backblazeb2.com/file/extupdates/domainredirect-101.zip (version 1.0.1 – 7 Ko)

    Changelog

    https://www.petitpoisson.be/public/domainredirect_changelog.txt

    1.1.2

    - modified the redirect method to accomodate JApplication being deprecated ; I now use the correct CMSapplication->redirect() method. This means that previous versions could have been sending http 303 (see other code) headers instead of http 301 (permanently redirected)...

     1.1.1

    - removed the DEBUG flag that forced the plugin to display messages instead of redirecting (stupid me!)
    - changed the update server address because of incompatibilities with my hoster

    1.1.0

    - More graceful redirect using JApplication->redirect()
    - Now correctly getting URL using Joomla's JURI
    - Changed the language files again again (always more careful!)
    - Domain name can now be up to 255 characters long
    - Added the ability to define a landing page instead of redirecting to the same page

    1.0.2

    - Changed the language files again (minor additions)
    - Changed the label on the parameters page to state that you REALLY CANNOT put http:// there !
    - Added a control in the plugin code that does not redirect (and triggers an error message) if http: is spotted in the target domain
    - Added update server

    1.0.1

    Bugfix with extended language files


    1.0.0

    Initial release