.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.

Was this answer helpful?

 Print this Article

Also Read

Reseller Account

Posted by yachtinterac, 09-02-2002, 10:00 AMHi, Does anybody know of a company that does web...

Huge traffic load in and out, but no disk usage...

Posted by myhken, 09-14-2008, 04:09 AMHello. In my review of vpsit.com I write about the...

Database server in different continent?

Posted by UberTricep, 10-27-2012, 08:23 AMHello, Is it wise to have a web server hosted in...

New PHP Exploit

Posted by jon-f, 09-11-2007, 06:27 PMcheck this out...

frequent rebooting - what can cause this?

Posted by Premier, 07-14-2007, 12:28 AMI have a server that is monitored with a system that...