Reputation: 5792
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.
Upvotes: 0
Views: 119
Reputation: 248
Have you turned mod_rewrite on? It won't do anything without the following line in .htaccess
RewriteEngine on
Upvotes: 0
Reputation: 219804
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
Upvotes: 3