Problem with .htaccess - Subdomain |
[eluser]gRoberts[/eluser]
Code: $Parts = explode('.', $_SERVER['HTTP_HOST']); The above code is not perfect, as I have had to deal with the fact that your users may try going to http://www.domain.com, http://subdomain.domain.com or http://domain.com You can get around this by using the .htaccess file to force the www if not supplied, Code: # Redirect non-www urls to www meaning you can simply use Code: $Parts = explode('.', $_SERVER['HTTP_HOST']); Your database would then just need to pass the $Path to the query to return data related to the subdomain. This will prevent you from having to create routes that pass the subdomain along, where as, each page will simply parse the url of the page and determine the data based on that. |
Welcome Guest, Not a member yet? Register Sign In |