Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2015-02-08 17:47:43

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,011
Website GitHub Mastodon Twitter

permanently redirect specific IP request for single page

I’m trying to redirect a particular IP from a particular section to another page. I know I can use the Deny rule but for now they haven’t been that bad. A search on the net returned the following but it returns a 500. Is there another way?

# permanently redirect specific IP request for single page
RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_HOST} xxx\.xx\.xxx\.xx
RewriteCond %{REQUEST_URI} /section/ $
RewriteRule .* /no.html [R=301,L]

Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#2 2015-02-08 20:43:44

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,137
GitHub

Re: permanently redirect specific IP request for single page

Does it work if you zap the space before $ on line 5?:

RewriteCond %{REQUEST_URI} /section/$

Last edited by gaekwad (2015-02-08 20:43:52)

Offline

#3 2015-02-09 06:20:50

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,011
Website GitHub Mastodon Twitter

Re: permanently redirect specific IP request for single page

gaekwad wrote #288102:

Does it work if you zap the space before $ on line 5?:

That fixed the 500 but also revealed that the rule is not working. Maybe I’ll just block him from the whole site.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#4 2015-02-09 19:52:26

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,137
GitHub

Re: permanently redirect specific IP request for single page

Try:

RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_ADDR} xxx.xxx.xxx.xxx
RewriteRule !^no.html$ /no.html [R,L]

Offline

Board footer

Powered by FluxBB