By HenryV
I want anyone to access my index.php, but no other files in the directory. However, 3 IPs can access anything in the directory. This .htaccess works fine in apache 2.2, but DO is 2.6, & I can’t find any examples on the web explaining exactly how to convert it. I know that “Allow from all” is now “Require all granted”, but I’m stumped on the proper syntax to allow the 3 IPs into all other files in the directory.
Authname “Admin” AuthUserFile secrethtpasswdfilename AuthType Basic
<files “index.php”> Allow from all -> now use Require all granted </files>
Order deny,allow Deny from all Require valid-user Allow from 1.2.3.4/24 Allow from 5.6.7.8 Allow from 9.10.11.12
Satisfy Any
Your expertise will be greatly appreciated as I’m pulling the remainder of my hair out.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hi,
Just for clarification, I think you meant Apache 2.4 rather than 2.6. Apache 2.6 hasn’t been released yet.
The easiest solution in your case would be to use a server stack that has Apache 2.4 configured with mod_access_compat which is an Apache 2.4 module that makes the old-style access control directives continue to work on Apache 2.4. For example, ServerPilot configures Apache on your server with mod_access_compat. This way, you won’t need to worry about converting your .htaccess file at all.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.