homepage Welcome to WebmasterWorld Guest from 54.227.41.242
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
PHP and mod_rewrite for internal redirect of subdomains
Variable

10+ Year Member



 
Msg#: 6133 posted 8:55 pm on Dec 15, 2004 (gmt 0)

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

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



 
Msg#: 6133 posted 6:33 am on Dec 17, 2004 (gmt 0)

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved