How can mod_rewrite be used in PHP to check for the existence of a file and redirect requests to a PHP script?

To check for the existence of a file and redirect requests to a PHP script using mod_rewrite in PHP, you can create a .htaccess file with mod_rewrite rules that redirect requests to a PHP script if the requested file does not exist. This can be useful for creating clean URLs or handling custom routing logic in your PHP application.

```php
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
```

In this example, the mod_rewrite rules check if the requested file does not exist (-f flag) and then redirect the request to index.php with the original URL passed as a query parameter. This allows you to handle the request in your PHP script and implement custom logic based on the requested URL.