htaccess – using password OR ip whitelist

You can use the Apache “Satisfy” directive. Here is an example of using it : AuthType Basic AuthName “Please Log In” AuthUserFile /some/path/.htpasswd Require valid-user Order deny,allow Deny from all Allow from 127.0.0.1 Satisfy any Access without password is only allowed from 127.0.0.1. Hope this helps.

symfony2 rewrite rules .htaccess app.php

Try this in your .htaccess file (inside the web directory): <IfModule mod_rewrite.c> Options +FollowSymlinks RewriteEngine On # Explicitly disable rewriting for front controllers RewriteRule ^app_dev.php – [L] RewriteRule ^app.php – [L] RewriteCond %{REQUEST_FILENAME} !-f # Change below before deploying to production #RewriteRule ^(.*)$ /app.php [QSA,L] RewriteRule ^(.*)$ /app_dev.php [QSA,L] </IfModule>

Password protecting a directory and all of it’s subfolders using .htaccess

It’s a simple two step process In your .htaccess put AuthType Basic AuthName “restricted area” AuthUserFile /path/to/the/directory/you/are/protecting/.htpasswd require valid-user use http://www.htaccesstools.com/htpasswd-generator/ or command line to generate password and put it in the .htpasswd Note 1: If you are using cPanel you should configure in the security section “Password Protect Directories” EDIT: If this didn’t work …

Read more