Jump to content

Slightly More Advanced Topic: Dynamic mod_rewrite with PHP ?


nefarious986

Recommended Posts

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 !

Link to comment
Share on other sites

  • 3 weeks later...

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

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.