301 avec et sans www
Exemple en excluant les stats awstats et tout le dossier admin
		
		
			
			
			
			
				
					
				| 
					
				 | 
						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
		
		
			
			
			
			
				
					
				| 
					
				 | 
						RewriteRule ^(cgi-bin/.+) $1 [NC,L]  | 
					
				
			 
		 
Exemple avec des liens incluant des ?
		
		
			
			
			
			
				
					
				| 
					
				 | 
						RewriteEngine on RewriteCond %{HTTP_HOST} ^jcpoiret.rd-corsica.net$ [NC] RewriteRule ^(.*) http://www.jcpoiret.com%{REQUEST_URI}  [NC,R=301,L]  | 
					
				
			 
		 
 
Changement de dossier
		
		
			
			
			
			
				
					
				| 
					
				 | 
						#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 :
		
		
			
			
			
			
				
					
				| 
					
				 | 
						RewriteRule .*.html - [L]  RewriteRule .*.asp - [L]  | 
					
				
			 
		 
 
 Forcer le HTTPS
		
		
			
			
			
			
				
					
				| 
					
				 | 
						RewriteEngine On RewriteCond %{SERVER_PORT} !^443$ RewriteRule ^(.*) https://votre_domaine/$1  | 
					
				
			 
		 
 
Cherche un mot
		
		
			
			
			
			
				
					
				| 
					
				 | 
						<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
		
		
			
			
			
			
				
					
				| 
					
				 | 
						<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/