<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Croc-Informatique.fr &#187; redirection</title>
	<atom:link href="http://www.croc-informatique.fr/tag/redirection/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.croc-informatique.fr</link>
	<description>Le Blog Note d'Olivier Legras</description>
	<lastBuildDate>Wed, 18 Jan 2012 16:29:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>Faire une redirection avec apache</title>
		<link>http://www.croc-informatique.fr/2011/06/faire-une-redirection-avec-apache/</link>
		<comments>http://www.croc-informatique.fr/2011/06/faire-une-redirection-avec-apache/#comments</comments>
		<pubDate>Thu, 23 Jun 2011 09:40:29 +0000</pubDate>
		<dc:creator>Olivier Legras</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[dossier]]></category>
		<category><![CDATA[mod_rewrite]]></category>
		<category><![CDATA[redirect]]></category>
		<category><![CDATA[redirection]]></category>
		<category><![CDATA[répertoire]]></category>
		<category><![CDATA[rewrite]]></category>

		<guid isPermaLink="false">http://www.croc-informatique.fr/2011/06/faire-une-redirection-avec-apache/</guid>
		<description><![CDATA[Voici deux méthodes permettant de faire une redirection avec apache. La première utilise la directive redirect d’apache et la seconde celle du mod Rewrite. Première méthode – Redirect: &#160; Imaginons, que vous voulez forcer l’utilisation de votre webmail en https, placez dans votre virtualhost ou dans votre fichier httpd.conf: Redirect permanent / https://mail.croc-informatique.fr/ ici toutes [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>Voici deux méthodes permettant de faire une redirection avec apache. La première utilise la directive redirect d’apache et la seconde celle du mod Rewrite.</p>
<h3>Première méthode – Redirect:</h3>
<p>&#160;</p>
<p>Imaginons, que vous voulez forcer l’utilisation de votre webmail en https, placez dans votre virtualhost ou dans votre fichier httpd.conf:</p>
<blockquote><p>Redirect permanent / <a href="https://mail.croc-informatique.fr/">https://mail.croc-informatique.fr/</a></p>
</blockquote>
<p>ici toutes les requêtes de <a href="http://mail.croc-informatique.fr">http://mail.croc-informatique.fr</a> seront redirigées vers&#160; <a href="https://mail.croc-informatique.fr/">https://mail.croc-informatique.fr/</a></p>
<p><span id="more-676"></span></p>
<p>Vous pouvez aussi utiliser cette directive pour rediriger votre ancien nom de domaine vers votre nouveau en plaçant le “redirect” dans le virtualhost de votre ancien nom de domaine.</p>
<p>Pensez à redémarrer le service httpd à chaque modification du fichier de configuration.</p>
<h3>&#160;</h3>
<h3>Deuxième méthode – Mod Rewrite:</h3>
<p>&#160;</p>
<p>Vérifiez que le mode_rewrite est chargé par apache dans votre fichier httpd.conf :</p>
<p>LoadModule rewrite_module modules/mod_rewrite.so</p>
<p>Puis placez dans votre virtualhost (HTTP) ces lignes :</p>
<blockquote><p>RewriteEngine On      <br />RewriteCond %{HTTPS} off       <br />RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}</p>
</blockquote>
<p>Ici, on redirige les requêtes http vers l’https du même nom de domaine. La page demandé reste inchangé. </p>
<p><u>Par exemple : </u></p>
<p>L’url <a href="http://mail.croc-informatique.fr/login.php">http://mail.croc-informatique.fr/login.php</a> sera redirigé vers <a href="https://mail.croc-informatique.fr/login.php">https://mail.croc-informatique.fr/login.php</a></p>
<p>Mais on peut très bien aussi faire une redirection de mail.croc-informatique.fr vers <a href="http://www.google.fr">www.google.fr</a> comme ceci :</p>
<blockquote><p>RewriteEngine On      <br />RewriteRule (.*) <a href="http://www.google.fr">http://www.google.fr</a></p>
</blockquote>
<p>Pensez à redémarrer le service httpd à chaque modification du fichier de configuration.</p>
<h3>&#160;</h3>
<h3>Rediriger un domaine vers répertoire</h3>
<p>&#160;</p>
<p>Voici une dernière redirection intéressante, toujours avec le “mod_rewrite” pour rediriger la racine d’un domaine vers un sous-dossier :</p>
<blockquote><p>RewriteEngine On      <br />RewriteRule ^/$ /monrepertoire/ [L,R=301]</p>
</blockquote>
<p>Ici on redirige <a href="http://www.mondomaine.fr">http://www.mondomaine.fr</a> vers <a href="http://www.mondomaine.fr/monrepertoire/">http://www.mondomaine.fr/monrepertoire/</a></p>
<div class="shr-publisher-676"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fwww.croc-informatique.fr%2F2011%2F06%2Ffaire-une-redirection-avec-apache%2F' data-shr_title='Faire+une+redirection+avec+apache'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='false' data-shr_href='http%3A%2F%2Fwww.croc-informatique.fr%2F2011%2F06%2Ffaire-une-redirection-avec-apache%2F' data-shr_title='Faire+une+redirection+avec+apache'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://www.croc-informatique.fr/2011/06/faire-une-redirection-avec-apache/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Redirection de port ou port forwarding avec Iptables</title>
		<link>http://www.croc-informatique.fr/2009/10/redirection-de-port-ou-port-forwarding-avec-iptables/</link>
		<comments>http://www.croc-informatique.fr/2009/10/redirection-de-port-ou-port-forwarding-avec-iptables/#comments</comments>
		<pubDate>Thu, 15 Oct 2009 06:55:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Réseau]]></category>
		<category><![CDATA[Sécurité]]></category>
		<category><![CDATA[iptables]]></category>
		<category><![CDATA[nat]]></category>
		<category><![CDATA[pat]]></category>
		<category><![CDATA[port forwarding]]></category>
		<category><![CDATA[port mapping]]></category>
		<category><![CDATA[redirection]]></category>
		<category><![CDATA[Routage]]></category>

		<guid isPermaLink="false">http://www.croc-informatique.fr/2009/10/redirection-de-port-ou-port-forwarding-avec-iptables/</guid>
		<description><![CDATA[Activation du routage : Sur un système LINUX, le routage est désactivé par défaut même si la machine comporte plusieurs cartes réseaux. Il faut activer ce routage pour utiliser un passerelle en LINUX. Pour cela, il suffit de modifier le fichier /etc/sysctl.conf. Modifier la ligne net.ipv4.ip_forward comme ceci : net.ipv4.ip_forward = 1 Une fois le [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><h3>Activation du routage :</h3>
<p>Sur un système LINUX, le routage est désactivé par défaut même si la machine comporte plusieurs cartes réseaux. Il faut activer ce routage pour utiliser un passerelle en LINUX. Pour cela, il suffit de modifier le fichier /etc/sysctl.conf. Modifier la ligne net.ipv4.ip_forward comme ceci :</p>
<p><tt>     <br />net.ipv4.ip_forward = 1      <br /></tt></p>
<p>Une fois le fichier corrigé, activer le changement avec la commande :</p>
<p><tt>     <br />sysctl -p      <br /></tt></p>
<p>Vérifiez que le routage est actif en consultant la valeur donnée à la fonction routage.</p>
<p><span id="more-454"></span></p>
<p><tt>     <br />[root@localhost ~]# cat /proc/sys/net/ipv4/ip_forward      <br />1      <br /></tt></p>
<p>Ici, on obtient la valeur 1, donc le routage est actif. Si vous obtenez 0, vous n’avez pas encore activé le routage.</p>
<p>&#160;</p>
<h3>Règles iptables :</h3>
<blockquote><p>iptables -t nat -A PREROUTING -d ip_du_serveur_iptables -p tcp &#8211;dport Numero_port_entrée -j DNAT &#8211;to-dest ip_distant:port_distant      <br />iptables -t nat -A POSTROUTING -d ip_distant -p tcp &#8211;dport 25 -j SNAT &#8211;to ip_du_serveur_iptables </p>
</blockquote>
<p><strong><u>Exemple :</u></strong></p>
<p>Si on souhaite mapper le port 30 sur le port 25 du serveur 81.0.0.1, voici les règles iptables à appliquer :</p>
<blockquote><p>iptables -t nat -A PREROUTING -d 192.168.0.1-p tcp &#8211;dport 30 -j DNAT &#8211;to-dest 81.0.0.1:25      <br />iptables -t nat -A POSTROUTING -d 81.0.0.1 -p tcp &#8211;dport 110 -j SNAT &#8211;to 192.168.0.1</p>
</blockquote>
<p>Pour sauvegarder les règles, tapez la commande : </p>
<p>iptables-save &gt; /etc/sysconfig/iptables </p>
<p>&#160;</p>
<h3>Problème rencontré : </h3>
<p>Je n’ai pas réussi à rediriger un port avec le nom de domaine du serveur distant. Apparemment, c’est impossible… Si quelqu’un a une idée?</p>
<div class="shr-publisher-454"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fwww.croc-informatique.fr%2F2009%2F10%2Fredirection-de-port-ou-port-forwarding-avec-iptables%2F' data-shr_title='Redirection+de+port+ou+port+forwarding+avec+Iptables'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='false' data-shr_href='http%3A%2F%2Fwww.croc-informatique.fr%2F2009%2F10%2Fredirection-de-port-ou-port-forwarding-avec-iptables%2F' data-shr_title='Redirection+de+port+ou+port+forwarding+avec+Iptables'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://www.croc-informatique.fr/2009/10/redirection-de-port-ou-port-forwarding-avec-iptables/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

