PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Serveur - Sécurité et techniques > alt.apache.configuration > redirecting two ip ranges and redirecting to the homepage
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
alt.apache.configuration Apache web server configuration issues.

redirecting two ip ranges and redirecting to the homepage

Réponse
 
LinkBack Outils de la discussion
Vieux 13/02/2008, 12h42   #1
Nospam
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut redirecting two ip ranges and redirecting to the homepage

can someone clarify this will redirect the two ip ranges and also redirect
to the homepage with htaccess:

Options +FollowSymLinks

RewriteEngine On

RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^www\.example\.comRewriteRule (.*)
https://www.example.com/$1 [R=301,L]

RewriteEngine On
Rewritecond %{REMOTE_ADDR} ^212\.6\.7\.8$ Rewritecond %{REMOTE_ADDR}
^213\.7\.7\.8$ RewriteRule .* http://www.example.com/404.html [R=301,L]


  Réponse avec citation
Vieux 13/02/2008, 13h18   #2
phantom
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: redirecting two ip ranges and redirecting to the homepage

"Nospam" <nospam@nospam.com> wrote in message
news:fouokp$qtd$1@north.jnrs.ja.net...
> can someone clarify this will redirect the two ip ranges and also redirect
> to the homepage with htaccess:
>
> Options +FollowSymLinks
>
> RewriteEngine On
>
> RewriteCond %{HTTP_HOST} .
> RewriteCond %{HTTP_HOST} !^www\.example\.com

<FORMATTING FIXED>
> RewriteRule (.*) https://www.example.com/$1 [R=301,L]


redirect to the homepage?
The above would redirect anything that isn't accessing the site via the host
name www.example.com (i.e. by IP address) to the URI they were requesting at
https://www.example.com/
e.g (if your site is at 1.2.3.4)
http://1.2.3.4/here would be 301ed to https://www.example.com/here


> RewriteEngine On
> Rewritecond %{REMOTE_ADDR} ^212\.6\.7\.8$
> Rewritecond %{REMOTE_ADDR} ^213\.7\.7\.8$
> RewriteRule .* http://www.example.com/404.html [R=301,L]

This will not do anything, a request cannot come from 213.6.7.8 AND
213.7.7.8 at the same time so your condition will never be met, you want:

Rewritecond %{REMOTE_ADDR} ^212\.6\.7\.8$ [OR]
Rewritecond %{REMOTE_ADDR} ^213\.7\.7\.8$
RewriteRule . http://www.example.com/404.html [R=301,L]



  Réponse avec citation
Vieux 14/02/2008, 06h10   #3
Nospam
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: redirecting two ip ranges and redirecting to the homepage

Suppose as well as the redirection I wanted to make forbidden for the two
ips, and redirect them to another page, would something like this work:


Options +FollowSymLinks

RewriteEngine On

RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^www\.example\.com
RewriteRule (.*) https://www.example.com/$1[R=301,L]

ErrorDocument 403 http://www.example.com/index2.html

<Limit GET HEAD POST>
order allow,deny
deny from 212.6.7.8
deny from 213.7.7.8
allow from all
</Limit>


  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 08h00.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,11573 seconds with 11 queries