301 avec et sans www
Exemple en excluant les stats awstats et tout le dossier admin
| 1 2 3 4 | RewriteEngine on RewriteCond %{HTTP_HOST} ^domaine\.ext$ [NC]  RewriteCond $1 !^(awstats\.pl|admin) RewriteRule (.*) http://www.domaine.ext/$1 [NC,R=301,L] | 
Ou pour exclure un dossier
| 1 | RewriteRule ^(cgi-bin/.+) $1 [NC,L] | 
Exemple avec des liens incluant des ?
| 1 2 3 | RewriteEngine on RewriteCond %{HTTP_HOST} ^jcpoiret.rd-corsica.net$ [NC] RewriteRule ^(.*) http://www.jcpoiret.com%{REQUEST_URI}  [NC,R=301,L] | 
Changement de dossier
| 1 2 | #redirecting to another URL RewriteRule ^dossier1/(.*)$ http://www.domaine.com/dossier2/$1 [L,R=301] | 
Besoin d’autoriser la redirection seulement si une extension existe :
| 1 2 | RewriteRule .*.html - [L]  RewriteRule .*.asp - [L] | 
Forcer le HTTPS
| 1 2 3 | RewriteEngine On RewriteCond %{SERVER_PORT} !^443$ RewriteRule ^(.*) https://votre_domaine/$1 | 
Cherche un mot
| 1 2 3 4 5 6 7 | <rule name="Dacia" enabled="true" stopProcessing="true"> <match url="^modeles\.php$" ignoreCase="true" /> <conditions logicalGrouping="MatchAll" trackAllCaptures="false">    <add input="{QUERY_STRING}" pattern="marq=Dacia" /> </conditions>  <action type="Redirect" url="index.php/autres/dacia" appendQueryString="false" redirectType="Permanent" /> </rule> | 
Cherche un mot générique
| 1 2 3 4 5 6 7 | <rule name="Query String Rewrite" stopProcessing="true"> <match url="^modeles\.php$" ignoreCase="true" /> <conditions logicalGrouping="MatchAll" trackAllCaptures="false">    <add input="{QUERY_STRING}" pattern="marq=([^=&]+)$" /> </conditions> <action type="Redirect" url="index.php/{C:1}" appendQueryString="false" redirectType="Permanent" /> </rule> | 
Pour tester le type de redirection, une seule adresse :
http://www.annuaire-info.com/outil-referencement/test-redirection/
Plus d’infos sur le rewriting et rès bien écrit au demeurant :
http://www.annuaire-info.com/lien-dur-lien-mou/
http://www.annuaire-info.com/lien-dur-lien-mou/
Please follow and like us:
 
							
