Portal Home > Knowledgebase > Articles Database > .htaccess question


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

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
best way to go? (Views: 681)


Language: