Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
| webdev:redirections [19/07/2017 13:36] – dolo | webdev:redirections [25/04/2019 19:57] (Version actuelle) – dolo | ||
|---|---|---|---|
| Ligne 3: | Ligne 3: | ||
| **Redirection PHP :** | **Redirection PHP :** | ||
| - | < | + | < |
| header(' | header(' | ||
| exit;</ | exit;</ | ||
| Ligne 15: | Ligne 15: | ||
| Pour rediriger le site entier vers une nouvelle adresse : | Pour rediriger le site entier vers une nouvelle adresse : | ||
| - | < | + | < |
| Ex : | Ex : | ||
| - | < | + | < |
| # Redirections pour le référencement | # Redirections pour le référencement | ||
| < | < | ||
| Ligne 27: | Ligne 27: | ||
| Pour changer un repertoire/ | Pour changer un repertoire/ | ||
| - | < | + | < |
| Redirect permanent / | Redirect permanent / | ||
| + | |||
| + | Global http to https : | ||
| + | <Code linenums> | ||
| + | # SSL/HTTPS | ||
| + | < | ||
| + | RewriteEngine On | ||
| + | RewriteCond %{HTTPS} !on | ||
| + | RewriteRule (.*) https:// | ||
| + | </ | ||
| + | </ | ||
| + | It's better to use a virtualhost to do that but that's the best way to do it on shared hosting : [[https:// | ||
| Ligne 39: | Ligne 50: | ||
| It is better than using window.location.href =, because replace() does not put the originating page in the session history, meaning the user won't get stuck in a never-ending back-button fiasco. If you want to simulate someone clicking on a link, use location.href. If you want to simulate an HTTP redirect, use location.replace.\\ | It is better than using window.location.href =, because replace() does not put the originating page in the session history, meaning the user won't get stuck in a never-ending back-button fiasco. If you want to simulate someone clicking on a link, use location.href. If you want to simulate an HTTP redirect, use location.replace.\\ | ||
| For example: | For example: | ||
| - | < | + | < |
| // similar behavior as an HTTP redirect | // similar behavior as an HTTP redirect | ||
| window.location.replace(" | window.location.replace(" | ||