Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

htaccess to redirect all but one IP address

Status
Not open for further replies.

Geronantimo

Technical User
Apr 3, 2006
79
SE
I am planning some site upgrades.

Currently, I have an index.php file that redirects visitors according to the language of their browser:
Code:
<?php
if(strstr($HTTP_ACCEPT_LANGUAGE,"en")) {
Header("Location: [URL unfurl="true"]http://www.DOMAIN.com/000/?sLang=en");[/URL]
}
elseif(strstr($HTTP_ACCEPT_LANGUAGE,"sv")) {
Header("Location: [URL unfurl="true"]http://www.DOMAIN.com/000/?sLang=sv");[/URL]
}
else {Header("Location: [URL unfurl="true"]http://www.DOMAIN.com/000/?sLang=en");[/URL]
}
?>

I need to replace the existing index.php in the root directory with a new index.php that can only be visited from my IP address. In addition, I need the index.php to be loaded in my browser when I enter the domain url (
I have added the following to .htaccess:
Code:
<Limit GET POST PUT>
 order deny,allow
 deny from all
 allow from 12.345.67.89
</LIMIT>
which denies all but my IP, however, I am stuck as to redirect all other visitors.

I'm sure many people have managed this in the past, but I have been unable to discover how - Any tips greatly appreciated.
 
My first guess would be that you would need to use rewrite rules (one of the vars that can be checked is the ip address) and rewrite the bare URL to your private php index file.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top