nefarious986 Posted December 23, 2007 Share Posted December 23, 2007 Hey guys, Lets say that you have a domain: ie. superheros.com. I have a script that allows you to dynamically create a sub-domain on the fly, ie. superman.superheros.com, or wonderwoman.superheros.com, or even bartman.superheros.com for that matter. Now the script works and you can access everything at superheros.com/subdomain.php?hero=superman But thats not really a 'sub-domain' .. Is there a way to modify apache or mod_rewrite dynamically, so when you create the sub-domain via PHP, it also create a 'superman' sub-domain, you would be able to access it at superman.superheros.com? I m thinking of some solutions, but I think I am way over complicating it, would appreciate some help or a fresh perspective. Thanks, and merry xmas everyone ! Quote Link to comment https://forums.phpfreaks.com/topic/82910-slightly-more-advanced-topic-dynamic-mod_rewrite-with-php/ Share on other sites More sharing options...
PHP_PhREEEk Posted December 23, 2007 Share Posted December 23, 2007 If you are the system admin, you can write a PHP script that will add the necessary lines to httpd.conf and/or vhosts, and then restart Apache. If you have CPanel, you can do it through something like snoopy that will pass along a remote hash. Fairly easy... PhREEEk Quote Link to comment https://forums.phpfreaks.com/topic/82910-slightly-more-advanced-topic-dynamic-mod_rewrite-with-php/#findComment-421693 Share on other sites More sharing options...
madmax Posted January 8, 2008 Share Posted January 8, 2008 Are you simply trying to remap an unlimited number of virtual subdomains to one physical block of content *OR* also automatically create the content+location etc. all on the fly? Not sure what you're actually trying to achieve here. If you're simply trying to remap ANY subdomain to a current server so, for example, to add homer.superheroes.com, or maggie.superheroes.com or lisa.superheroes.com or matt-groening.superheroes.com etc. etc. etc. - basically <any-name>.superheroes.com - then you can do this easily in any Apache Virtualhost using a wildcard (*) ServerAlias ServerAlias *.superheroes.com Quote Link to comment https://forums.phpfreaks.com/topic/82910-slightly-more-advanced-topic-dynamic-mod_rewrite-with-php/#findComment-434047 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.