.htaccess question

Posted by MikeWalczak, 10-23-2012, 02:25 PM
Hey everyone, I've got a question about .htaccess. I am continuing developing on an established website and do not want the public to be able to access anything beyond the index.html page. However, I do also want the option to open particular parts of the website for the public to access when I am ready. I also want to be able to access the full website myself. Here is the .htaccess that I had come up through Google searches yesterday and it was actually working. RewriteEngine On RewriteBase / # IF not from your address RewriteCond %{REMOTE_ADDR} !^00\.00\.000\.00$ (Removed my IP) # AND not for /example directory RewriteCond %{REQUEST_URI} !^/index.html RewriteCond %{REQUEST_URI} !^/images # THEN sen them to /index.html RewriteRule (.*) /index.html [R=307,L] However today for some reason the .htaccess is not working properly. The website redirects properly, however it doesn't allow me to view paste index.html even though my IP (per whatismyip.com) is set correctly within the code. The allow directories part also works since I am able to view areas once I designate them as open. Thoughts on why this would have all the sudden not recognized me? Thanks.

Posted by ForzaHost, 10-24-2012, 04:57 AM
It could be that the server or the htaccess file isn't properly rendering the %{REMOTE_ADDR}. I've had issues with this in the past with various scripts as well, I just think the variables aren't greatly reliable.

Posted by robertk1, 10-24-2012, 05:49 AM
Why not simply place the private area into a sub-domain or folder. Select something that is not easily guessed, or put a password on it. Leave your index and simply copy the finished product over when ready.

Posted by bdowne01, 10-24-2012, 03:02 PM
Seconding Robert's idea. It's much easier to secure a directory with a .htaccess file then trying to redirect and do the stuff with mod_rewrite. People can spoof remote IP's anyway. At its simplest, you can just create a unique user and password combination and lock the directory down with it. You can add people as needed later. Here's a primer I found from a quick Google search.

這篇文章有幫助嗎?

 列印本文

Also Read

php/mysql q

Posted by Sammy89, 02-14-2011, 03:45 PMis there a better way to write: Posted by...

Compromised???

Posted by Chinese Democracy, 04-20-2009, 12:01 PMIt appears that one new sign-up on a shared...

How is this possible?

Posted by iUnknown, 09-16-2008, 02:27 PMHello, When I run the following command on my server:...

Myspace add

Posted by NameSniper, 03-17-2007, 04:11 PMHi everyone, I am new to Myspace and was wondering...

Hosting Related Press Releases

Posted by SoftWareRevue, 04-29-2009, 10:30 AM Post your press release for the WHT community...