How does mod_rewrite in .htaccess files play a role in creating and managing subdomains in PHP?
Mod_rewrite in .htaccess files can be used to redirect requests for subdomains to specific PHP scripts or folders, allowing for the creation and management of subdomains in PHP. By using mod_rewrite rules, you can dynamically handle subdomains within your PHP application, enabling you to customize the behavior and content based on the subdomain requested. ```apache RewriteEngine on RewriteCond %{HTTP_HOST} ^subdomain\.example\.com$ [NC] RewriteRule ^(.*)$ /subdomain.php [L] ``` In this example, any requests to "subdomain.example.com" will be redirected to "subdomain.php" within the application. This allows for custom handling of subdomains within the PHP code.