Welcome to WebmasterWorld Guest from 23.22.250.113

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

PHP and mod_rewrite for internal redirect of subdomains

     

Variable

8:55 pm on Dec 15, 2004 (gmt 0)

10+ Year Member



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?

Example:
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?

jatar_k

6:33 am on Dec 17, 2004 (gmt 0)

WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member



>> 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.

 

Featured Threads

Hot Threads This Week

Hot Threads This Month