News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

John Rockefeller's Blog:
PHP Tricks How To Handle Multiple Domains
May 27, 2008 @ 11:11:01

John Rockefeller has a tip he'd like to share with all of the other PHP developers out there - a little method he's come up with to host multiple domains off of the same code.

This is really handy for those of us who have the same code handling multiple sites or multiple sub-domains. A case in point: When I coded NetBoardz (my free forum hosting service now defunct), I had one codebase handling all 250 forums. How? Simple. When the code runs, it determines which site the user is loading and does different things (like using different databases) dynamically.

He shows the two key points to dividing things up - grabbing the domain and subdomain they were trying to access. This can be fed into a script that can switch things like layout or even functionality based on which site they've chosen.

1 comment voice your opinion now!
trick multiple domain same codebase subdomain hostname


blog comments powered by Disqus

Similar Posts

Site News: The Move to Jobs.PHPDeveloper.org

Hardened-PHP Project: Advisory - phpMyAdmin Multiple CSRF Vulnerabilities

Cal Evans' Blog: Six ways to be a better client for your developer - Point 8

Till Klampaeckel's Blog: How to setup multiple stores on different domains with Magento

HowToForge.com: Running Apache2 With PHP5 And PHP4 At The Same Time


Community Events

Don't see your event here?
Let us know!


library symfony2 performance release conference part2 application configure interview community voicesoftheelephpant php7 laravel series framework example opinion podcast api introduction

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework