2010-12-15 81 views
0

J'ai deux hôtes virtuels définis sur le même répertoire sur le serveur. On écoute sur le port 80 et l'autre sur 443.Redirection de réécriture SSL apache2

je 3 fichiers

index.html 
secure.html 
view.html 

Chaque fichier a un menu:

<ul> 
<li><a href="index.html">Index</a></li> 
<li><a href="secure.html">secure</a></li> 
<li><a href="view.html">view</a></li> 
</ul> 

je voudrais mettre en redirigeant il répond à ces conditions :

http://localhost/secure.html - va à https://localhost/secure.html

http://localhost/index.html - va à http://localhost/index.html

http://localhost/view.html - va à http://localhost/view.html

https://localhost/index.html - va à http://localhost/index.html

https://localhost/view.html - va à http://localhost/view.html

et quand je suis en
https://localhost/secure.html et je clique sur

Index me prend à http://localhost/index.html

Voir me amène à http://localhost/view.html

Comment pourrais-je y parvenir?

Je sais que je dois mettre ces derniers dans le fichier .htaccess mais je ne sais pas comment définir ces confitions,

+0

Appartient à [serverfault] (http://serverfault.com/). –

Répondre

1

Essayez ces deux règles:

RewriteCond %{HTTPS} !=on 
RewriteRule ^/secure\.html$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] 
RewriteCond %{HTTPS} =on 
RewriteRule !^/secure\.html$ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] 

Si vous avez plus de ce single fichier, il suffit d'étendre le modèle comme ^/(secure\.html|…)$.