restrict website for all other IP addresses except mine

I want to restrict website for all other IP addresses except mine from .htaccess I am redirecting all others to my test.php page..

I have code like this:

Options +FollowSymlinks
RewriteCond %{REMOTE_ADDR} !=my_ip
RewriteRule index.php$ /test.php [R=301,L]

But, It's still allow other IP to use website. What should I do? Thanks.

Answers


Add this to your htaccess file (obviously change the IP address to be your own):

Order Deny,Allow 
Allow from 1.2.3.4 
Deny from all

Need Your Help

Calculating two element onkeyup - How can I convert this to jQuery?

jquery jquery-selectors onkeyup

Im having a trouble converting my scripts to jQuery. How can I compute two elements at once?

Database trigger to update a row on parent table after child table has been updated

sql sql-server triggers database-trigger

First time creating a Database trigger. I have a child table that when its cost column is updated, I need its parent table to also update its cost column to reflect the change.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.