Hallo,
ich habe einen kleinen kostenlosen Subdomain-Service und möchte es auf Subdirectory erweitern.
Ich habe ein Script im Einsatz (nicht von mir), dass automatisch über .htaccess und index.php statt einer Fehlerseite die entsprechende Weiterleitung aus der Datenbank "rausfischt".
Wie muss ich das Script erweitern, damit es nicht nur "subhost.url.de", sondern auch "url.de/subhost" mit einschließt?!
Wäre für Eure Hilfe dankbar,
Gruß
Tycriss
ich habe einen kleinen kostenlosen Subdomain-Service und möchte es auf Subdirectory erweitern.
Ich habe ein Script im Einsatz (nicht von mir), dass automatisch über .htaccess und index.php statt einer Fehlerseite die entsprechende Weiterleitung aus der Datenbank "rausfischt".
Code:
// Get the hostname typed in $subhost = $_SERVER['HTTP_HOST']; $subhost = strtolower($subhost); // Get away the "www." in front (in case there is one) $subhost = str_replace("www.", "", $subhost); // First get everything after the first slash to realize path forwarding later on $subhost2 = strstr($subhost, "/"); // If $subhost2 contains a value, delete it from $subhost if ($subhost2) { $subhost = str_replace($subhost2, "", $subhost); } // In case the main domain is called, redirect to the startpage and exit if($subhost=="$maindomain" || $subhost=="www.$maindomain") { header("Location: [url]http://www.[/url]$maindomain/$startpage"); exit; } // And now lets prepare the variable $subhost2 for pathforwarding // This is important, because if forwarding goes directly to a file (e.g. something.html), no slash must be at the end if($_SERVER['REQUEST_URI']=="/") { $subhost2 = ""; } else { $subhost2 = $_SERVER['REQUEST_URI']; } // Now check for results
Wäre für Eure Hilfe dankbar,
Gruß
Tycriss