Welcome to WebmasterWorld Guest from 18.104.22.168 , register , free tools , login , search , pro membership , help , library , announcements , recent posts , open posts Become a Pro Member
PHP and mod_rewrite for internal redirect of subdomains Variable
I am trying to route subdomains to different directories based on whether the subdomain is in a mysql db. I am accepting all subdomains via domain wildcarding and I need to route all the invalid subdomains(not in db) to one directory and all the valid ones(in db) to another directory.
Can I do the internal redirect that mod_rewrite offers in PHP?
www.example.com -> / validsub1.example.com -> /validsubs/ validsub2.example.com -> /validsubs/ invalidsub1.example.com -> /invalidsubs/ invalidsub2.example.com -> /invalidsubs/
If I can't do this in PHP, is there a way to check a mysql database and incorporate the result into a conditional for mod_rewrite?
>> is there a way to check a mysql database and incorporate the result into a conditional for mod_rewrite
I really am not sure. The logical situation I see is this,
all requests for subdomains go to a script
script checks to see if they exist in db scripts redirects/includes the proper things
I don't like the thought of all the redirects frankly, seems like it might cause some issues with the SEO side of things. I am not really sure about the rewrite side of it though.