Vous pouvez utiliser LocationMatch
cette regex:
<LocationMatch "^/.">
</LocationMatch>
unique DOT après ^/
se assurer qu'il ya au moins un caractère après http://my.domain.com/
provoquant donc à ne pas correspondre à la page d'atterrissage.
More details about LocationMatch
Test:
Créer cette directive comme:
<LocationMatch "^/(?<sitename>.+)">
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule^http://www.%{HTTP_HOST}%{REQUEST_URI}?u=%{env:MATCH_SITENAME} [L,R=302]
</LocationMatch>
Maintenant, pour tester ce que je fais:
curl -kI -A "Chrome" -L 'http://localhost/index.php'
HTTP/1.1 302 Found
Date: Mon, 11 Jul 2016 22:31:37 GMT
Server: Apache/2.4.12 (Unix) OpenSSL/1.0.1j PHP/5.6.9 mod_wsgi/3.5 Python/2.7.9
Location: http://www.localhost/index.php?u=index.php
Content-Type: text/html; charset=iso-8859-1
HTTP/1.1 200 OK
Date: Mon, 11 Jul 2016 22:31:37 GMT
Server: Apache/2.4.12 (Unix) OpenSSL/1.0.1j PHP/5.6.9 mod_wsgi/3.5 Python/2.7.9
X-Powered-By: PHP/5.6.9
Content-Type: text/html; charset=UTF-8
curl -kI -A "Chrome" -L 'http://localhost/user.php'
HTTP/1.1 302 Found
Date: Mon, 11 Jul 2016 22:33:57 GMT
Server: Apache/2.4.12 (Unix) OpenSSL/1.0.1j PHP/5.6.9 mod_wsgi/3.5 Python/2.7.9
Location: http://www.localhost/user.php?u=user.php
Content-Type: text/html; charset=iso-8859-1
HTTP/1.1 200 OK
Date: Mon, 11 Jul 2016 22:33:57 GMT
Server: Apache/2.4.12 (Unix) OpenSSL/1.0.1j PHP/5.6.9 mod_wsgi/3.5 Python/2.7.9
X-Powered-By: PHP/5.6.9
Content-Type: text/html; charset=UTF-8
curl -kI -A "Chrome" -L 'http://localhost'
HTTP/1.1 200 OK
Date: Mon, 11 Jul 2016 22:32:47 GMT
Server: Apache/2.4.12 (Unix) OpenSSL/1.0.1j PHP/5.6.9 mod_wsgi/3.5 Python/2.7.9
X-Powered-By: PHP/5.6.9
Content-Type: text/html; charset=UTF-8
Vous pouvez clairement voir que la redirection www
ne se produit pas quand je demande la page d'atterrissage, mais qui arrive quand je demande /index.php
Ceci est déclenché sur la racine aussi bien ... J'ai ajouté quelques précisions sur la façon dont Je teste ceci, peut-être que Shibboleth change de comportement – JLewkovich
J'ai ajouté des informations de test pour montrer comment cette directive fonctionne correctement – anubhava
Je teste maintenant avec 'Header set X-TEST-ME" TESTING "' et il apparaît sur toutes les URLs ... Je pense que vous pouvez résoudre ce partiellement en utilisant RewriteRules, j'espère une solution plus propre – JLewkovich