@mike
To redirect all subdomains to a PHP file using .htaccess, you can use the following code:
1 2 3 |
RewriteEngine On RewriteCond %{HTTP_HOST} ^(.+).yourdomain.com$ [NC] RewriteRule ^(.*)$ http://yourdomain.com/your-php-file.php?subdomain=%1 [L,R=301] |
This is assuming you want to redirect all subdomains to the same PHP file, and you want the subdomain name to be passed as a parameter (subdomain
) to the PHP file.
Explanation of the code:
Make sure to replace yourdomain.com
with your actual domain name and your-php-file.php
with the filename of your PHP file that you want to redirect to.