What is the recommended method to protect a directory using .htaccess and deny access from all, while still allowing access through a specific PHP script?

To protect a directory using .htaccess and deny access from all while still allowing access through a specific PHP script, you can use the following method: 1. Create a .htaccess file in the directory you want to protect. 2. Use the "Deny from all" directive in the .htaccess file to deny access to all users. 3. Add an exception for the specific PHP script you want to allow access to using the "Allow from" directive.

```php
Order Deny,Allow
Deny from all
Allow from <your_ip_address>
```

Replace `<your_ip_address>` with the IP address you want to allow access to the directory. This will block access to the directory for all users except for the specified IP address.