game_over Posted February 14, 2010 Share Posted February 14, 2010 Is this possible? to close my website for everyone, except me. Either via php or htaccess and IPs or sumthin' ? It's about to be re launching and i want to have any access to my site directed to a page saying it's closed, but except for me. is it possible? Link to comment Share on other sites More sharing options...
0 AnthonySterling Posted February 14, 2010 Share Posted February 14, 2010 Sure, create a cookie with a unique value. If the user(you) has that cookie, allow access. Rudimentary, but KISS. ;) Link to comment Share on other sites More sharing options...
0 JMann Veteran Posted February 14, 2010 Veteran Share Posted February 14, 2010 (edited) What happens if Forcer was to delete that Cookie? Don't know much about that kind of setup, but couldn't that cause issues? I've setup Windows Authentication on an IIS7 Windows Server before, plus I think you can create a htaccess file which you can lock down. Or even more, you could just develop the site in a sub-directory, which means that when a user hits your website directly they could just get a offline page which would be set as your Index file? Link to comment Share on other sites More sharing options...
0 AnthonySterling Posted February 14, 2010 Share Posted February 14, 2010 forcer would has to create the cookie to allow access anyway, if he were to delete it, he'd just have to re-create it. You could create a server-side mechanism to do this, but then you're opening it up to possible abuse. If he had a static IP on his client though, you're right, creating an access white list would be the preferred method. :) Link to comment Share on other sites More sharing options...
0 Commodore Max Posted February 14, 2010 Share Posted February 14, 2010 There are multiple ways of doing this. With Apache, you can allow only certain IP addresses. Or you could have a password protected welcome page. Link to comment Share on other sites More sharing options...
0 Matt Posted February 14, 2010 Share Posted February 14, 2010 make a splash page saying under construction, make a sub dir and call it a day. theres no need to get more complex than that. Link to comment Share on other sites More sharing options...
0 Cupcakes Posted February 14, 2010 Share Posted February 14, 2010 Just toss the following into an .htaccess file in the directory you want off-limits to everyone BUT you. AuthName "Protected" AuthType Basic <Limit GET POST> order deny,allow deny from all allow from 192.168.1.1 </Limit> Just change 192.168.1.1 to your IP. Go to ipchicken if you don't know your IP address. You can always then just create a special 403.html template page that will show up when a user hits that page versus showing the Forbidden error message. Link to comment Share on other sites More sharing options...
0 lt8480 Posted February 14, 2010 Share Posted February 14, 2010 All of these solutions are overkill... The simplest is using .htaccess, but ip limit might be a problem if you have a non static ip... instead I would recommend using .htaccess to change the "index" to something other than index.php/.htm/.html (or whatever you are using) and then password protecting your entire site using htaccess. Your "temporary" new index may be best in a subfolder and then allow access to that directory using htaccess. Anyone who visits the general site www.......com will then see the temporary index, anyone who forcefully tries to go anywhere else or has a bookmark etc. with get a password prompt (which of failing or canceling you can redirect back to the temporary index) On logging in the first time save your password and you wont have to keep entering it. Simples. Link to comment Share on other sites More sharing options...
0 Kudos Veteran Posted February 15, 2010 Veteran Share Posted February 15, 2010 All of these solutions are overkill... The simplest is using .htaccess, but ip limit might be a problem if you have a non static ip... instead I would recommend using .htaccess to change the "index" to something other than index.php/.htm/.html (or whatever you are using) and then password protecting your entire site using htaccess. Your "temporary" new index may be best in a subfolder and then allow access to that directory using htaccess. Anyone who visits the general site www.......com will then see the temporary index, anyone who forcefully tries to go anywhere else or has a bookmark etc. with get a password prompt (which of failing or canceling you can redirect back to the temporary index) On logging in the first time save your password and you wont have to keep entering it. Simples. Yours is easily as complex as everyone else's. Personally, I would use a rewrite to serve up a site down page to any IP but your own. Who cares if his IP isn't static, they don't change unless his connection drops anyway. If it does, he can just change the IP in the htaccess file again. Link to comment Share on other sites More sharing options...
0 Rohdekill Posted February 15, 2010 Share Posted February 15, 2010 Yours is easily as complex as everyone else's. Personally, I would use a rewrite to serve up a site down page to any IP but your own. Who cares if his IP isn't static, they don't change unless his connection drops anyway. If it does, he can just change the IP in the htaccess file again. You're assuming the OP is in a static location. He never said only his home pc can get to it. It may be a laptop, changing ip's frequently, yet still wants only his pc to access it. What I do is a simple mac address and logged in user name of the pc lookup. If they both fail, redirect to offline page. Link to comment Share on other sites More sharing options...
0 Raa Posted February 15, 2010 Share Posted February 15, 2010 Just shove it into a subdir. Simple, effective. Link to comment Share on other sites More sharing options...
0 game_over Posted February 15, 2010 Author Share Posted February 15, 2010 Lol static ip is fine, I'll give that htaccess a go :-) Link to comment Share on other sites More sharing options...
0 RoomKid Posted February 15, 2010 Share Posted February 15, 2010 Use Apache's log in. You need a password to login and access the files. If you use the method suggested by +Cupcakes, what about accessing the files from other computers? Link to comment Share on other sites More sharing options...
0 Cupcakes Posted February 15, 2010 Share Posted February 15, 2010 Use Apache's log in. You need a password to login and access the files. If you use the method suggested by +Cupcakes, what about accessing the files from other computers? If the computers are on the same network, then they're utilizing the same IP address. Otherwise if you want other IP addresses to access the site you would just add another line of allow from followed by their IP address. Link to comment Share on other sites More sharing options...
0 vhane Posted February 15, 2010 Share Posted February 15, 2010 The simplest way to do this properly is to use apache's basic authentication: http://httpd.apache.org/docs/1.3/howto/auth.html#basic 1. Create a password file 2. Set the configuration to use this password file (via .htaccess) Link to comment Share on other sites More sharing options...
0 Kudos Veteran Posted February 15, 2010 Veteran Share Posted February 15, 2010 You're assuming the OP is in a static location. He never said only his home pc can get to it. It may be a laptop, changing ip's frequently, yet still wants only his pc to access it. What I do is a simple mac address and logged in user name of the pc lookup. If they both fail, redirect to offline page. I think it's a fair assumption, I'd be shocked if he did work from more than 2 locations. You know we're talking about a web server, right? No browser sends either of those pieces of information (ActiveX is a piece of ****). Link to comment Share on other sites More sharing options...
0 mounty Posted February 16, 2010 Share Posted February 16, 2010 Edit with your ip below, stick the script inside the webroot htaccess file, and then anyone not on your ip will receive error 503 service unavailable ErrorDocument 503 "Website down for maintenance" RewriteEngine On RewriteCond %{REMOTE_ADDR} !^127\.0\.0\.1$ RewriteRule .* - [R=503,L] Link to comment Share on other sites More sharing options...
Question
game_over
Is this possible? to close my website for everyone, except me. Either via php or htaccess and IPs or sumthin' ?
It's about to be re launching and i want to have any access to my site directed to a page saying it's closed, but except for me.
is it possible?
Link to comment
Share on other sites
16 answers to this question
Recommended Posts