How can URL rewriting be implemented in PHP to convert query strings to user-friendly URLs?

URL rewriting in PHP can be implemented using the .htaccess file to rewrite URLs with query strings into user-friendly URLs. This can be achieved by using mod_rewrite rules to redirect requests to a PHP script that parses the URL and handles the corresponding content retrieval.

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

In the above code snippet, the .htaccess file is configured to rewrite all requests to index.php with the original URL as a query parameter. The PHP script can then parse the URL parameter and handle the corresponding content retrieval based on the user-friendly URL structure.