|
|
|
|
||||||
| alt.apache.configuration Apache web server configuration issues. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
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] |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
"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] |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
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> |
|
![]() |
| Outils de la discussion | |
|
|