Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente | ||
webdev:redirections [25/04/2019 19:22] 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 : | ||
Ligne 34: | Ligne 34: | ||
# SSL/HTTPS | # SSL/HTTPS | ||
< | < | ||
- | Redirect permanent / https://sophrologie-sport.com/ | + | RewriteEngine On |
+ | RewriteCond %{HTTPS} !on | ||
+ | RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} | ||
</ | </ | ||
</ | </ | ||
+ | It's better to use a virtualhost to do that but that's the best way to do it on shared hosting : [[https:// | ||
Ligne 47: | 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(" |