adamhuxtable
adamhuxtable

Reputation: 479

htaccess specific ip

Hey guys I want to allow certain ip's to access my webpage, I have it working for one ip but I want to add another how would I go about this.

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_HOST} !^217\.20\.17\.210
RewriteRule (.*) http://google.com/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

I thought I would be able to just to duplicate the current line with the ip address and input the new one but it didn't work.

Upvotes: 2

Views: 99

Answers (1)

Jon Lin
Jon Lin

Reputation: 143906

RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_HOST} !^217\.20\.17\.210
RewriteCond %{REMOTE_HOST} !^123\.123\.123\.123
RewriteRule (.*) http://google.com/$1 [R=301,L]

Added to allow 123.123.123.123 doesn't work for you?

As an alternative, you could try just using the Allow/Deny in mod_authz_host, such as:

Order Deny,Allow
Allow from 217.20.17.210
Allow from 123.123.123.123

It's a lot easier to maintain.

Upvotes: 2

Related Questions