.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

Having Problem with SQL need help

Posted by shawnchin, 01-26-2011, 09:11 AMHello World, Having Problem of (Warning:...

Would this be Secure?

Posted by aldo, 01-09-2008, 03:19 AMI currently only use cookies for my user systems, I see...

DNS management problems on DirectAdmin

Posted by Narcolog, 06-02-2012, 06:46 PMNeed to add this 2 lines for domain via DirectAdmin...

how to partion drive

Posted by kmwrestle, 03-27-2008, 11:54 PMim assembling my server now....waiting on the 90degree...

enabling shell_exec() for some user

Posted by dendis, 03-26-2008, 08:24 PMHi all, I need to run one PHP script from crontab as...